@xoxno/sdk-js 1.0.200 → 1.0.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sdk/stellar/__tests__/strategy-program.test.d.ts +9 -0
- package/dist/cjs/sdk/stellar/governance.d.ts +5 -3
- package/dist/cjs/sdk/stellar/scval-encode.d.ts +29 -9
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/__tests__/strategy-program.test.d.ts +9 -0
- package/dist/sdk/stellar/governance.d.ts +5 -3
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/sdk/stellar/scval-encode.d.ts +29 -9
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-language wire-format check for the aggregator's packed strategy program.
|
|
3
|
+
*
|
|
4
|
+
* The same fixtures are asserted byte-for-byte in
|
|
5
|
+
* `contracts/swap-aggregator/tests/unit/payload_wire_format.rs` and
|
|
6
|
+
* `arb-algo/stellar-indexer/src/transaction/abi.rs`. If this file and those
|
|
7
|
+
* diverge, routes built by this SDK will be rejected on-chain.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -37,9 +37,11 @@ export type StellarGovernanceSalt = string | Buffer | Uint8Array;
|
|
|
37
37
|
export declare const STELLAR_GOVERNANCE_ZERO_PREDECESSOR: string;
|
|
38
38
|
/**
|
|
39
39
|
* `add_asset_to_spoke` / `edit_asset_in_spoke` payload: the per-(hub, spoke,
|
|
40
|
-
* asset) risk config. Caps are asset-native i128 decimal strings
|
|
41
|
-
*
|
|
42
|
-
* asset
|
|
40
|
+
* asset) risk config. Caps are asset-native i128 decimal strings and are
|
|
41
|
+
* always enforced ceilings — there is no "unlimited" sentinel, and `'0'` means
|
|
42
|
+
* the asset accepts nothing on that side. ltv/threshold/bonus/liquidationFees
|
|
43
|
+
* are bps. Oracle config is asset-level on the price-aggregator, not
|
|
44
|
+
* per-spoke.
|
|
43
45
|
*/
|
|
44
46
|
export interface SpokeAssetArgs {
|
|
45
47
|
hubId: number;
|
|
@@ -8,12 +8,22 @@
|
|
|
8
8
|
import { xdr } from '@stellar/stellar-sdk';
|
|
9
9
|
/**
|
|
10
10
|
* On-chain swap venues, validated at runtime for a caller-supplied venue.
|
|
11
|
-
* Mirrors the Soroban-only aggregator router's
|
|
11
|
+
* Mirrors the Soroban-only aggregator router's opcode table.
|
|
12
12
|
*/
|
|
13
13
|
export declare const STELLAR_SWAP_VENUES: readonly ["Soroswap", "Aquarius", "Phoenix", "Sushi", "CometDex"];
|
|
14
14
|
export type StellarSwapVenue = (typeof STELLAR_SWAP_VENUES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Instruction opcode per venue. Part of the on-chain ABI — see
|
|
17
|
+
* `contracts/swap-aggregator/src/program.rs`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const STELLAR_SWAP_VENUE_OPCODE: Record<StellarSwapVenue, number>;
|
|
20
|
+
/** Wire version of the packed program. Must match the contract's `VERSION`. */
|
|
21
|
+
export declare const STELLAR_PROGRAM_VERSION = 1;
|
|
22
|
+
/** Split weights are parts per million. */
|
|
23
|
+
export declare const PPM_DENOMINATOR = 1000000;
|
|
15
24
|
export interface StellarStrategySwapHopInput {
|
|
16
|
-
|
|
25
|
+
/** Quote-side estimate; not carried on the wire. */
|
|
26
|
+
amountOut?: string;
|
|
17
27
|
pool: string;
|
|
18
28
|
tokenIn: string;
|
|
19
29
|
tokenOut: string;
|
|
@@ -21,10 +31,25 @@ export interface StellarStrategySwapHopInput {
|
|
|
21
31
|
}
|
|
22
32
|
export interface StellarStrategySwapPathInput {
|
|
23
33
|
hops: StellarStrategySwapHopInput[];
|
|
34
|
+
/** Absolute share of this path's starting-token balance, in ppm. */
|
|
24
35
|
splitPpm: number;
|
|
25
36
|
}
|
|
26
37
|
export interface StellarStrategyPayloadInput {
|
|
38
|
+
/** Aquarius pool whose LP shares (`tokenIn`) are burned before routing. */
|
|
39
|
+
burnPool?: string;
|
|
40
|
+
/** Per-constituent floors for the burn, in the pool's own token order. */
|
|
41
|
+
burnMinAmounts?: string[];
|
|
42
|
+
/** Aquarius pool that mints `tokenOut` from the routed constituents. */
|
|
43
|
+
mintPool?: string;
|
|
44
|
+
/** Minimum LP shares the mint must deliver. */
|
|
45
|
+
mintMinShares?: string;
|
|
46
|
+
/** Constituents of `mintPool`, in pool order. Required with `preSwapAmount`. */
|
|
47
|
+
mintPoolTokens?: string[];
|
|
27
48
|
paths: StellarStrategySwapPathInput[];
|
|
49
|
+
/** Caller-solved amount that balances a lopsided mint before the deposit. */
|
|
50
|
+
preSwapAmount?: string;
|
|
51
|
+
/** Pre-swap direction: pool token A into B when true, B into A when false. */
|
|
52
|
+
preSwapFromA?: boolean;
|
|
28
53
|
referralId?: number | string;
|
|
29
54
|
tokenIn: string;
|
|
30
55
|
tokenOut: string;
|
|
@@ -99,13 +124,8 @@ export declare const tupleHubAssetAmountVec: (entries: Array<{
|
|
|
99
124
|
*/
|
|
100
125
|
export declare const scStruct: (fields: Record<string, xdr.ScVal>) => xdr.ScVal;
|
|
101
126
|
/**
|
|
102
|
-
* Encode
|
|
103
|
-
*
|
|
104
|
-
*/
|
|
105
|
-
export declare const encodeSwapVenue: (venue: StellarSwapVenue) => xdr.ScVal;
|
|
106
|
-
/**
|
|
107
|
-
* Encode the aggregator router's decoded `StrategyPayload` struct. The caller
|
|
108
|
-
* usually receives this as quote `routeXdr`; this helper is for tests and for
|
|
127
|
+
* Encode the aggregator router's `StrategyPayload`. The caller usually receives
|
|
128
|
+
* this already encoded as quote `routeXdr`; this helper is for tests and for
|
|
109
129
|
* callers that construct routes locally.
|
|
110
130
|
*/
|
|
111
131
|
export declare const encodeStrategyPayload: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,r){r.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>pt,STELLAR_LENDING_CONTROLLER:()=>o,STELLAR_LENDING_TOPICS:()=>Er,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Mr,XOXNO_LENDING_STELLAR_TICKER:()=>Ir,buildSameTokenRepaySwapSteps:()=>Yr,buildStellarAcceptOwnershipTx:()=>We,buildStellarAddRewardsTx:()=>lt,buildStellarApproveBlendPoolTx:()=>Xe,buildStellarApproveTokenTx:()=>Ke,buildStellarBatchSwapTx:()=>Hr,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>B,buildStellarCctpForwardTx:()=>to,buildStellarClaimRevenueTx:()=>it,buildStellarCreateLiquidityPoolTx:()=>ut,buildStellarExecuteCancellerResetTx:()=>ar,buildStellarExecuteStrategyTx:()=>zr,buildStellarFlashLoanTx:()=>F,buildStellarGovernanceAddSpokeImmediateTx:()=>pr,buildStellarGovernanceCreateHubImmediateTx:()=>sr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Yt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>tr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>rr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>or,buildStellarGovernanceExecuteTx:()=>Jt,buildStellarGovernanceExecuteUpdateDelayTx:()=>er,buildStellarGovernancePauseTx:()=>cr,buildStellarGovernanceRevokeRoleImmediateTx:()=>dr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>lr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>ir,buildStellarGrantRoleTx:()=>Be,buildStellarLendingIdentifier:()=>Lr,buildStellarLiquidateTx:()=>H,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Ue,buildStellarMultiplyTx:()=>V,buildStellarPauseTx:()=>Ge,buildStellarProposeAddAssetToSpokeTx:()=>Pt,buildStellarProposeAddSpokeTx:()=>qt,buildStellarProposeApproveBlendPoolTx:()=>Ct,buildStellarProposeApproveTokenTx:()=>Mt,buildStellarProposeCancellerResetTx:()=>ur,buildStellarProposeConfigureAssetOracleTx:()=>Ht,buildStellarProposeConfigureMarketOracleTx:()=>Ft,buildStellarProposeCreateHubTx:()=>_t,buildStellarProposeCreateLiquidityPoolTx:()=>Gt,buildStellarProposeDeployPoolTx:()=>Bt,buildStellarProposeEditAssetInSpokeTx:()=>kt,buildStellarProposeEditOracleToleranceTx:()=>jt,buildStellarProposeGovernanceUpgradeTx:()=>Vt,buildStellarProposeGrantGovernanceRoleTx:()=>Qt,buildStellarProposeMigrateControllerTx:()=>Wt,buildStellarProposeRemoveAssetFromSpokeTx:()=>Rt,buildStellarProposeRemoveSpokeTx:()=>wt,buildStellarProposeRevokeBlendPoolTx:()=>Ut,buildStellarProposeRevokeGovernanceRoleTx:()=>Kt,buildStellarProposeRevokeTokenTx:()=>Lt,buildStellarProposeSetAccumulatorTx:()=>xt,buildStellarProposeSetAggregatorTx:()=>vt,buildStellarProposeSetMinBorrowCollatTx:()=>It,buildStellarProposeSetPositionLimitsTx:()=>At,buildStellarProposeSetPositionManagerTx:()=>Ot,buildStellarProposeSetPriceAggregatorTx:()=>ht,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Et,buildStellarProposeSetSwapAggregatorTx:()=>ft,buildStellarProposeTransferCtrlOwnershipTx:()=>zt,buildStellarProposeTransferGovOwnTx:()=>Zt,buildStellarProposeUnpauseTx:()=>Sr,buildStellarProposeUpdateDelayTx:()=>Xt,buildStellarProposeUpgradeControllerTx:()=>$t,buildStellarProposeUpgradePoolParamsTx:()=>Nt,buildStellarProposeUpgradePoolTx:()=>Dt,buildStellarRenewAccountTx:()=>nt,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>K,buildStellarRepayTx:()=>z,buildStellarRevokeBlendPoolTx:()=>Qe,buildStellarRevokeRoleTx:()=>De,buildStellarRevokeTokenTx:()=>Ze,buildStellarSetAccumulatorTx:()=>je,buildStellarSetAggregatorTx:()=>Fe,buildStellarSetMarketOracleConfigTx:()=>Ye,buildStellarSetOracleSanityBoundsTx:()=>rt,buildStellarSetOracleToleranceTx:()=>et,buildStellarSetOracleTx:()=>Je,buildStellarSetPositionLimitsTx:()=>Ve,buildStellarSetPriceAggregatorTx:()=>He,buildStellarSetSpokeAssetFlagsTx:()=>tt,buildStellarSetSwapAggregatorTx:()=>ze,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>G,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>$e,buildStellarUnpauseTx:()=>Ne,buildStellarUpdateAccountThresholdTx:()=>st,buildStellarUpdateIndexesTx:()=>ot,buildStellarUpgradeControllerTx:()=>Ce,buildStellarUpgradeLiquidityPoolParamsTx:()=>at,buildStellarWithdrawBatchTx:()=>D,buildStellarWithdrawTx:()=>$,buildTx:()=>C,decodeStellarLendingEvent:()=>Or,encodeAssetOracle:()=>Me,encodeInterestRateModel:()=>xe,encodeMarketOracleConfigInput:()=>Le,encodeMarketParamsRaw:()=>Ae,encodePositionLimits:()=>_e,encodePriceKey:()=>qe,encodeStrategyPayloadToRouteXdr:()=>Wr,extractEventOrder:()=>Cr,getStellarAccountPositions:()=>ye,getStellarAggregatorQuote:()=>Dr,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>le,getStellarAssetGraph:()=>Te,getStellarAssetMarkets:()=>pe,getStellarAssetPage:()=>se,getStellarAssets:()=>re,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ge,getStellarHub:()=>de,getStellarHubGraph:()=>me,getStellarHubs:()=>oe,getStellarLendingContext:()=>ee,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>te,getStellarQuoteTokens:()=>$r,getStellarReserve:()=>ae,getStellarReserveGraph:()=>he,getStellarReserveHolders:()=>ie,getStellarReserves:()=>ue,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>fe,getStellarSpokes:()=>ne,getStellarUserActivity:()=>be,getStellarUserPositions:()=>Se,mapQuoteResponseToAggregatorSwap:()=>Vr,mapQuoteResponseToStrategyPayload:()=>Fr,mapQuoteResponseToStrategySwap:()=>jr,mapSorobanError:()=>oo,mapStellarPositionActivityType:()=>Gr,prepareStellarBuiltTx:()=>Zr,prepareStellarTxXdr:()=>Kr,stellarLendingDispatchKey:()=>gr,stellarLendingRead:()=>ve,syntheticEventOrder:()=>Ur,tagStellarInvokedContractError:()=>Qr,toBase64Xdr:()=>br,toStellarPositionMode:()=>Jr});const o={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=o[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=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),A=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(o)},_=(e,t)=>null==e?v():t(e),q=(e,t)=>k({asset:b(t),hub_id:g(e)}),w=(e,t,r)=>c.xdr.ScVal.scvVec([q(e,t),y(r)]),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)},O=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),I=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},M=e=>{if("string"==typeof e)return E(I(e));if(e instanceof Uint8Array)return 0===e.length?O():E(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?E(I(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(I(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(I(e.bytes)):0===e.bytes.length?O():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 r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!S.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function C(e,t,r){const o=e.controllerAddress??s(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return C(e,"supply",[b(e.caller),T(r),g(o),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]),_(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 D(e,t){return C(e,"withdraw",[b(e.caller),T(t.accountNonce),P([...t.withdrawals]),_(t.to,b)])}function $(e,t){return D(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return C(e,"repay",[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 F(e,t){return C(e,"flash_loan",[b(e.caller),q(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)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,c.xdr.ScVal.scvVec([b(t),y(r)]);var t,r}))))]);var r}function V(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return C(e,"multiply",[b(e.caller),T(r),g(o),q(t.collateral.hubId,t.collateral.asset),y(t.debtToFlashLoan),q(t.debt.hubId,t.debt.asset),g(t.mode),M(t.steps),_(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),_(t.convertSwap,M)])}function X(e,t){return C(e,"swap_debt",[b(e.caller),T(t.accountNonce),q(t.existingDebt.hubId,t.existingDebt.asset),y(t.newDebtAmount),q(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[b(e.caller),T(t.accountNonce),q(t.current.hubId,t.current.asset),y(t.fromAmount),q(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function K(e,t){return C(e,"repay_debt_with_collateral",[b(e.caller),T(t.accountNonce),q(t.collateral.hubId,t.collateral.asset),y(t.collateralAmount),q(t.debt.hubId,t.debt.asset),M(t.steps),m(t.closePosition)])}const Z="/stellar-lending",J=25,Y=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${Z}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/live-state`,t),re=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),oe=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),ne=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),ue=(e,t={},r)=>{const{hubId:o,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${Z}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ae=(e,t,r,o,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${Y(o)}`,n),ie=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${Y(o)}/holders`,{...u,params:{side:n}}),le=(e,t,r)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}`,r),se=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}/page`,{...o,params:{...r}}),pe=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}/markets`,{...o,params:{side:r}}),de=(e,t,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,r),ce=(e,t,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,r),Se=(e,t,r)=>e.fetchWithTimeout(`${Z}/users/${Y(t)}/positions`,r),be=(e,t,r={},o)=>{const{skip:n,top:u}=r;return e.fetchWithTimeout(`${Z}/users/${Y(t)}/activity`,{...o,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},ye=(e,t,r)=>e.fetchWithTimeout(`${Z}/accounts/${Y(t)}/positions`,r),ge=(e,t={},r)=>{const{top:o=J,continuationToken:n}=t;return e.fetchWithTimeout(`${Z}/governance/proposals`,{...r,params:{top:o,...n?{continuationToken:n}:{}}})},Te=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}/graph`,{...o,params:{...r}}),me=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...o,params:{...r}}),fe=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...o,params:{...r}}),he=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${Y(o)}/graph`,{...u,params:{...n}}),ve=e=>({context:t=>ee(e,t),liveState:t=>te(e,t),assets:t=>re(e,t),hubs:t=>oe(e,t),spokes:t=>ne(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?ue(e,t,r):ue(e,{},t);var o},reserve:(t,r,o,n)=>ae(e,t,r,o,n),reserveHolders:(t,r,o,n,u)=>ie(e,t,r,o,n,u),asset:(t,r)=>le(e,t,r),assetMarkets:(t,r,o)=>pe(e,t,r,o),hub:(t,r)=>de(e,t,r),spoke:(t,r)=>ce(e,t,r),userPositions:(t,r)=>Se(e,t,r),userActivity:(t,r,o)=>be(e,t,r,o),accountPositions:(t,r)=>ye(e,t,r),governanceProposals:(t,r)=>ge(e,t,r),assetGraph:(t,r,o)=>Te(e,t,r,o),hubGraph:(t,r,o)=>me(e,t,r,o),spokeGraph:(t,r,o)=>fe(e,t,r,o),reserveGraph:(t,r,o,n,u)=>he(e,t,r,o,n,u)}),xe=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)}),Ae=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)}),_e=e=>k({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),qe=e=>{if("Token"in e&&e.Token)return x([h("Token"),b(e.Token)]);if("Ref"in e&&e.Ref)return x([h("Ref"),h(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},we=e=>{if("Stellar"in e)return x([h("Stellar"),b(e.Stellar)]);if("Symbol"in e)return x([h("Symbol"),h(e.Symbol)]);if("String"in e)return x([h("String"),f(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Pe=e=>{if("Spot"===e)return x([h("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return x([h("Twap"),g(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},ke=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return x([h(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Re=e=>{if("Market"===e||"Fundamental"===e)return x([h(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Ee=e=>{if("Reflector"in e){const t=e.Reflector;return x([h("Reflector"),k({asset:we(t.asset),contract:b(t.contract),read_mode:Pe(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return x([h("MultiFeed"),k({contract:b(t.contract),feed_id:f(t.feedId),kind:ke(t.kind),nature:Re(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},Oe=e=>{const t=e;return k({decimals:g(t.decimals),max_stale_seconds:T(t.maxStaleSeconds),provider:Ee(t.provider)})},Ie=e=>{if("RequireDisjoint"===e)return x([h("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return x([h("AllowShared"),x(t.map((e=>k({contract:b(e.contract),kind:ke(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},Me=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return k({asset_decimals:g(Number(t.assetDecimals)),independence:Ie(t.independence),max_price_stale_seconds:T(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:y(String(t.maxSanityPriceWad)),min_sanity_price_wad:y(String(t.minSanityPriceWad)),sources:x(r.map((e=>(e=>{if("Feed"in e)return x([h("Feed"),Oe(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return x([h("Scaled"),k({factor:Oe(t.factor),max_factor_wad:y(t.maxFactorWad),min_factor_wad:y(t.minFactorWad),quote:qe(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return x([h("LpShare"),k({key_a:qe(t.keyA),key_b:qe(t.keyB),kind:x([h(t.kind||"ConstantProduct")]),pool:b(t.pool),reserve_a_decimals:g(t.reserveADecimals),reserve_b_decimals:g(t.reserveBDecimals),share_decimals:g(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:k({lower_ratio_bps:g(n),upper_ratio_bps:g(o)})})},Le=Me;function Ce(e,t){return C(e,"upgrade",[A(t.wasmHash)])}function Ue(e,t){return C(e,"migrate",[g(t.newVersion)])}function Ge(e){return C(e,"pause",[])}function Ne(e){return C(e,"unpause",[])}function Be(e,t){return C(e,"grant_role",[b(t.account),h(t.role)])}function De(e,t){return C(e,"revoke_role",[b(t.account),h(t.role)])}function $e(e,t){return C(e,"transfer_ownership",[b(t.newOwner),g(t.liveUntilLedger)])}function We(e){return C(e,"accept_ownership",[])}function ze(e,t){return C(e,"set_swap_aggregator",[b(t.aggregator)])}function He(e,t){return C(e,"set_price_aggregator",[b(t.aggregator)])}const Fe=ze;function je(e,t){return C(e,"set_accumulator",[b(t.accumulator)])}function Ve(e,t){return C(e,"set_position_limits",[_e(t)])}function Xe(e,t){return C(e,"approve_blend_pool",[b(t.pool)])}function Qe(e,t){return C(e,"revoke_blend_pool",[b(t.pool)])}const Ke=Xe,Ze=Qe;function Je(e,t){return C(e,"set_oracle",[qe(t.key),Me(t.oracle)])}const Ye=Je;function et(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return C(e,"set_tolerance",[qe(t.key),k({lower_ratio_bps:g(n),upper_ratio_bps:g(o)})])}function tt(e,t){return C(e,"set_spoke_asset_flags",[g(t.spokeId),q(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function rt(e,t){return C(e,"set_oracle_sanity_bounds",[b(t.asset),y(t.minPriceWad),y(t.maxPriceWad)])}function ot(e,t){return C(e,"update_indexes",[b(e.caller),x(t.assets.map((e=>q(e.hubId,e.asset))))])}function nt(e,t){return C(e,"renew_account",[b(e.caller),T(t.accountNonce)])}function ut(e,t){return C(e,"create_liquidity_pool",[g(t.hubId),b(t.asset),Ae(t.params)])}function at(e,t){return C(e,"upgrade_liquidity_pool_params",[q(t.hubId,t.asset),xe(t.params)])}function it(e,t){return C(e,"claim_revenue",[b(e.caller),x(t.assets.map((e=>q(e.hubId,e.asset))))])}function lt(e,t){return C(e,"add_rewards",[b(e.caller),P(t.rewards)])}function st(e,t){return C(e,"update_account_threshold",[b(e.caller),m(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const pt="00".repeat(32),dt=e=>{if("string"==typeof e)return A(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)},ct=(e,...t)=>x([h(e),...t]),St=e=>k({new_owner:b(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),bt=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)}),yt=e=>k({account:b(e.account),role:h(e.role)});function gt(e,t,r){const o=e.governanceAddress??d(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Tt=(e,t,r)=>gt(e,"propose",[b(e.caller),t,dt(r)]),mt=(e,t,r)=>gt(e,"execute_self",[v(),t,dt(r)]);function ft(e,t,r){return Tt(e,ct("SetSwapAggregator",b(t.aggregator)),r)}function ht(e,t,r){return Tt(e,ct("SetPriceAggregator",b(t.aggregator)),r)}const vt=ft;function xt(e,t,r){return Tt(e,ct("SetAccumulator",b(t.accumulator)),r)}function At(e,t,r){return Tt(e,ct("SetPositionLimits",_e(t)),r)}function _t(e,t){return Tt(e,ct("CreateHub"),t)}function qt(e,t){return Tt(e,ct("AddSpoke"),t)}function wt(e,t,r){return Tt(e,ct("RemoveSpoke",g(t.spokeId)),r)}function Pt(e,t,r){return Tt(e,ct("AddAssetToSpoke",bt(t)),r)}function kt(e,t,r){return Tt(e,ct("EditAssetInSpoke",bt(t)),r)}function Rt(e,t,r){return Tt(e,ct("RemoveAssetFromSpoke",k({hub_asset:q((o=t).hubId,o.asset),spoke_id:g(o.spokeId)})),r);var o}function Et(e,t,r){return Tt(e,ct("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:y((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:g(o.liquidationBonusFactorBps),spoke_id:g(o.spokeId),target_hf_wad:y(o.targetHfWad)})),r);var o}function Ot(e,t,r){return Tt(e,ct("SetPositionManager",b(t.manager),m(t.isActive)),r)}function It(e,t,r){return Tt(e,ct("SetMinBorrowCollateralUsd",y(t.floorWad)),r)}function Mt(e,t,r){return Tt(e,ct("ApproveToken",b(t.token)),r)}function Lt(e,t,r){return Tt(e,ct("RevokeToken",b(t.token)),r)}function Ct(e,t,r){return Tt(e,ct("ApproveBlendPool",b(t.pool)),r)}function Ut(e,t,r){return Tt(e,ct("RevokeBlendPool",b(t.pool)),r)}function Gt(e,t,r){return Tt(e,ct("CreateLiquidityPool",k({asset:b((o=t).asset),hub_id:g(o.hubId),params:Ae(o.params)})),r);var o}function Nt(e,t,r){return Tt(e,ct("UpgradeLiquidityPoolParams",k({hub_asset:q((o=t).hubId,o.asset),params:xe(o.params)})),r);var o}function Bt(e,t,r){return Tt(e,ct("DeployPool",A(t.wasmHash)),r)}function Dt(e,t,r){return Tt(e,ct("UpgradePool",A(t.wasmHash)),r)}function $t(e,t,r){return Tt(e,ct("UpgradeController",A(t.wasmHash)),r)}function Wt(e,t,r){return Tt(e,ct("MigrateController",g(t.newVersion)),r)}function zt(e,t,r){return Tt(e,ct("TransferCtrlOwnership",St(t)),r)}function Ht(e,t,r){return Tt(e,ct("ConfigureAssetOracle",k({key:qe((o=t).key),oracle:Me(o.oracle)})),r);var o}const Ft=Ht;function jt(e,t,r){return Tt(e,ct("EditOracleTolerance",k({key:qe((o=t).key),tolerance:g(o.tolerance)})),r);var o}function Vt(e,t,r){return Tt(e,ct("UpgradeGov",A(t.wasmHash)),r)}function Xt(e,t,r){return Tt(e,ct("UpdateGovDelay",g(t.newDelay)),r)}function Qt(e,t,r){return Tt(e,ct("GrantGovRole",yt(t)),r)}function Kt(e,t,r){return Tt(e,ct("RevokeGovRole",yt(t)),r)}function Zt(e,t,r){return Tt(e,ct("TransferGovOwnership",St(t)),r)}function Jt(e,t){const r=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),o=dt(t.predecessor??pt);return gt(e,"execute",[v(),b(t.target),h(t.functionName),r,o,dt(t.salt)])}function Yt(e,t,r){return mt(e,ct("UpgradeGov",A(t.wasmHash)),r)}function er(e,t,r){return mt(e,ct("UpdateGovDelay",g(t.newDelay)),r)}function tr(e,t,r){return mt(e,ct("GrantGovRole",yt(t)),r)}function rr(e,t,r){return mt(e,ct("RevokeGovRole",yt(t)),r)}function or(e,t,r){return mt(e,ct("TransferGovOwnership",St(t)),r)}const nr=e=>x(e.map(b));function ur(e,t,r){return gt(e,"propose_canceller_reset",[nr(t.newCancellers),dt(r)])}function ar(e,t,r){return gt(e,"execute_canceller_reset",[_(t.executor,b),nr(t.newCancellers),dt(r)])}function ir(e,t){return gt(e,"set_spoke_asset_flags",[b(e.caller),g(t.spokeId),q(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function lr(e,t){return gt(e,"set_oracle_sanity_bounds",[b(e.caller),b(t.asset),y(t.minPriceWad),y(t.maxPriceWad)])}function sr(e){return gt(e,"create_hub",[b(e.caller)])}function pr(e){return gt(e,"add_spoke",[b(e.caller)])}function dr(e,t){return gt(e,"revoke_role_immediate",[b(t.account),h(t.role)])}function cr(e){return gt(e,"pause",[b(e.caller)])}function Sr(e,t){return Tt(e,ct("Unpause"),t)}const br=e=>e.toXDR("base64"),yr=e=>c.xdr.ScVal.fromXDR(e,"base64"),gr=e=>e.map((e=>String((0,c.scValToNative)(yr(e))))).join(":"),Tr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),mr=e=>Number(e),fr=e=>String(e),hr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),vr=["None","Multiply","Long","Short"],xr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net"],Ar=e=>Array.isArray(e)?e:[],_r=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],xr[mr(o)]??Tr(o)),positionType:t,hubId:mr(e[1]),asset:fr(e[2]),scaledAmountRay:Tr(e[3]),indexRay:Tr(e[4]),amount:Tr(e[5]),liquidationThresholdBps:r?void 0:mr(e[6]),liquidationBonusBps:r?void 0:mr(e[7]),loanToValueBps:r?void 0:mr(e[8]),liquidationFeesBps:r?void 0:mr(e[9])};var o},qr=e=>{return{owner:fr(e[0]),spokeId:mr(e[1]),mode:(t=e[2],vr[mr(t)]??"None")};var t},wr=e=>Array.isArray(e)?e[1]:void 0,Pr=e=>{const t=(r=e,Array.isArray(r)?fr(r[0]):fr(r));var r;if("Token"===t)return{Token:fr(wr(e))};if("Ref"===t)return{Ref:fr(wr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:fr(t.Token)};if(void 0!==t.Ref)return{Ref:fr(t.Ref)}}return{Token:fr(e)}},kr=e=>{const t=e.tolerance??{};return{assetDecimals:mr(e.asset_decimals),maxPriceStaleSeconds:mr(e.max_price_stale_seconds),sources:Ar(e.sources).map((e=>e)),tolerance:{upperRatio:mr(t.upper_ratio_bps),lowerRatio:mr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Tr(e.min_sanity_price_wad),maxSanityPriceWad:Tr(e.max_sanity_price_wad)}},Rr={"market:create":e=>({topic:"market:create",data:{hubId:mr(e.hub_id),baseAsset:fr(e.base_asset),maxBorrowRate:Tr(e.max_borrow_rate),baseBorrowRate:Tr(e.base_borrow_rate),slope1:Tr(e.slope1),slope2:Tr(e.slope2),slope3:Tr(e.slope3),midUtilization:Tr(e.mid_utilization),optimalUtilization:Tr(e.optimal_utilization),maxUtilization:Tr(e.max_utilization),reserveFactor:mr(e.reserve_factor),marketAddress:fr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:fr(e.asset),maxBorrowRateRay:Tr(e.max_borrow_rate),baseBorrowRateRay:Tr(e.base_borrow_rate),slope1Ray:Tr(e.slope1),slope2Ray:Tr(e.slope2),slope3Ray:Tr(e.slope3),midUtilizationRay:Tr(e.mid_utilization),optimalUtilizationRay:Tr(e.optimal_utilization),maxUtilizationRay:Tr(e.max_utilization),reserveFactorBps:mr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Ar(e).map((e=>{return t=Ar(e),{hubId:mr(t[0]),asset:fr(t[1]),timestamp:mr(t[2]),supplyIndexRay:Tr(t[3]),borrowIndexRay:Tr(t[4]),cash:Tr(t[5]),suppliedRay:Tr(t[6]),borrowedRay:Tr(t[7]),revenueRay:Tr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Ar(e).map((e=>{const t=e;return{hubId:mr(t.hub_id),asset:fr(t.asset),params:(r=t.params,{maxBorrowRateRay:Tr(r.max_borrow_rate),baseBorrowRateRay:Tr(r.base_borrow_rate),slope1Ray:Tr(r.slope1),slope2Ray:Tr(r.slope2),slope3Ray:Tr(r.slope3),midUtilizationRay:Tr(r.mid_utilization),optimalUtilizationRay:Tr(r.optimal_utilization),maxUtilizationRay:Tr(r.max_utilization),reserveFactorBps:mr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:mr(r.flashloan_fee),assetId:fr(r.asset_id),assetDecimals:mr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Ar(e);return{topic:"position:batch_update",data:{accountId:Tr(t[0]),accountAttributes:qr(Ar(t[1])),updates:[...Ar(t[2]).map((e=>_r(Ar(e),"Deposit"))),...Ar(t[3]).map((e=>_r(Ar(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:mr(e.hub_id),asset:fr(e.asset),receiver:fr(e.receiver),caller:fr(e.caller),amount:Tr(e.amount),fee:Tr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Pr(e.key),oracle:kr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:fr(e.asset),oracle:kr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:fr(e.liquidator),accountId:Tr(e.account_id),repaidUsdWad:Tr(e.repaid_usd_wad),bonusBps:Tr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Tr(e.account_id),totalBorrowUsdWad:Tr(e.total_borrow_usd_wad),totalCollateralUsdWad:Tr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:fr(e.token),amount:Tr(e.amount),usdValueWad:Tr(e.usd_value_wad),accountId:Tr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:mr(e.hub_id),asset:fr(e.asset),amount:Tr(e.amount),fee:Tr(e.fee),amountSent:Tr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:fr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:hr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:fr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:fr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:fr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:fr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:hr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:mr(e.max_supply_positions),maxBorrowPositions:mr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Tr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:fr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:mr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Tr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Tr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:mr(t.liquidation_bonus_factor_bps)}}}},Er=Object.freeze(Object.keys(Rr));function Or(e,t){const r=gr(e),o=Rr[r];return o?o((0,c.scValToNative)(yr(t))):null}const Ir="XLENDXLM-a7c9f3",Mr=1e4;function Lr(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${Ir}-${r}`}function Cr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Ur(e,t=0){return e*Mr+t}function Gr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Nr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Br=e=>e.baseUrl??i[e.network];async function Dr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=Nr(Br(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function $r(e){const t=Nr(Br(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Wr=e=>R(e).toXDR("base64");function zr(e,t){const r=e.routerAddress??p(e.network),o=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence),u=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(o.call("execute_strategy",b(e.caller),y(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Hr(e,t){return zr(e,t)}function Fr(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(Xr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Xr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function jr(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Fr(e,t)}const Vr=Fr,Xr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Qr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Kr(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Qr(r.invokedContractId,e);throw e}}async function Zr(e,t,r){return Kr(e,t.xdr,r)}function Jr(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 Yr(e,t){return new Uint8Array(0)}const eo=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 to(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(eo(e.message)),c.xdr.ScVal.scvBytes(eo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const ro={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function oo(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=ro[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>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,buildStellarApproveBlendPoolTx:()=>T.buildStellarApproveBlendPoolTx,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,buildStellarProposeConfigureAssetOracleTx:()=>T.buildStellarProposeConfigureAssetOracleTx,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,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>T.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>T.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>T.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>T.buildStellarProposeSetSwapAggregatorTx,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,buildStellarRevokeBlendPoolTx:()=>T.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>T.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>T.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>T.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>T.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>T.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>T.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>T.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>T.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>T.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>T.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>T.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>T.buildStellarSetSwapAggregatorTx,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,encodeAssetOracle:()=>T.encodeAssetOracle,encodeInterestRateModel:()=>T.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>T.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>T.encodeMarketParamsRaw,encodePositionLimits:()=>T.encodePositionLimits,encodePriceKey:()=>T.encodePriceKey,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,...r}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=r,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=r,S=p?.Authorization,b="Bearer undefined"===S?void 0:S,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}=o??{},{revalidate:h,...v}=i??{},x="GET"!==d||b?void 0:h??m,A="GET"!==d||b||x?void 0:l??n,_={...a,...c,method:d,...Object.keys(y).length?{headers:y}:{},cache:A,next:{...f,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",T,_);const q=await fetch(T,_).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 q.text();if(!q.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,q.status,q.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)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||r},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||r};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const b=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),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:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},g=["PATCH","POST","DELETE","PUT"];var T=r(397);const m=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),f=()=>({static:{},params:{},leaves:[]});function h(e,t,r,o){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...r,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!b(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:y,auth:g,method:T,headers:m,cache:f,next:h,debug:v,continuationToken:x,...A}=d,_=g?`Bearer ${g}`:void 0,q={...m,..._?{Authorization:_}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],u]};return o.fetchWithTimeout(u,{method:T,params:A,body:y,headers:q,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,r]of Object.entries(y)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)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:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:r,def:n}=t.leaves[0];i=h(r,n,o,e)}else{i={};for(const{rawPath:r,def:n}of t.leaves)i[m(r.split("/").pop().replace(/^:/,""))]=h(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),u=r)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=r(n,{...o,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],r=(...e)=>t(...e);return Object.assign(r,t)}return u};if(i[e]){const r=i[e];i[e]=e=>({...r(e),...t(e)})}else i[e]=t}return i};return r(t,{})}module.exports=o})();
|
|
1
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,r){r.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>St,STELLAR_LENDING_CONTROLLER:()=>o,STELLAR_LENDING_TOPICS:()=>Mr,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Nr,XOXNO_LENDING_STELLAR_TICKER:()=>Cr,buildSameTokenRepaySwapSteps:()=>ro,buildStellarAcceptOwnershipTx:()=>Fe,buildStellarAddRewardsTx:()=>dt,buildStellarApproveBlendPoolTx:()=>Ze,buildStellarApproveTokenTx:()=>Ye,buildStellarBatchSwapTx:()=>Vr,buildStellarBorrowBatchTx:()=>$,buildStellarBorrowTx:()=>W,buildStellarCctpForwardTx:()=>no,buildStellarClaimRevenueTx:()=>pt,buildStellarCreateLiquidityPoolTx:()=>lt,buildStellarExecuteCancellerResetTx:()=>sr,buildStellarExecuteStrategyTx:()=>jr,buildStellarFlashLoanTx:()=>X,buildStellarGovernanceAddSpokeImmediateTx:()=>Sr,buildStellarGovernanceCreateHubImmediateTx:()=>cr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>rr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>nr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>ur,buildStellarGovernanceExecuteTransferGovOwnTx:()=>ar,buildStellarGovernanceExecuteTx:()=>tr,buildStellarGovernanceExecuteUpdateDelayTx:()=>or,buildStellarGovernancePauseTx:()=>gr,buildStellarGovernanceRevokeRoleImmediateTx:()=>br,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>dr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>pr,buildStellarGrantRoleTx:()=>We,buildStellarLendingIdentifier:()=>Br,buildStellarLiquidateTx:()=>V,buildStellarMigrateFromBlendTx:()=>Q,buildStellarMigrateTx:()=>Ge,buildStellarMultiplyTx:()=>K,buildStellarPauseTx:()=>De,buildStellarProposeAddAssetToSpokeTx:()=>Et,buildStellarProposeAddSpokeTx:()=>kt,buildStellarProposeApproveBlendPoolTx:()=>Ut,buildStellarProposeApproveTokenTx:()=>Nt,buildStellarProposeCancellerResetTx:()=>lr,buildStellarProposeConfigureAssetOracleTx:()=>Vt,buildStellarProposeConfigureMarketOracleTx:()=>Xt,buildStellarProposeCreateHubTx:()=>Pt,buildStellarProposeCreateLiquidityPoolTx:()=>Dt,buildStellarProposeDeployPoolTx:()=>Wt,buildStellarProposeEditAssetInSpokeTx:()=>It,buildStellarProposeEditOracleToleranceTx:()=>Qt,buildStellarProposeGovernanceUpgradeTx:()=>Kt,buildStellarProposeGrantGovernanceRoleTx:()=>Jt,buildStellarProposeMigrateControllerTx:()=>Ft,buildStellarProposeRemoveAssetFromSpokeTx:()=>Ot,buildStellarProposeRemoveSpokeTx:()=>Rt,buildStellarProposeRevokeBlendPoolTx:()=>Gt,buildStellarProposeRevokeGovernanceRoleTx:()=>Yt,buildStellarProposeRevokeTokenTx:()=>Bt,buildStellarProposeSetAccumulatorTx:()=>qt,buildStellarProposeSetAggregatorTx:()=>At,buildStellarProposeSetMinBorrowCollatTx:()=>Ct,buildStellarProposeSetPositionLimitsTx:()=>_t,buildStellarProposeSetPositionManagerTx:()=>Lt,buildStellarProposeSetPriceAggregatorTx:()=>wt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Mt,buildStellarProposeSetSwapAggregatorTx:()=>xt,buildStellarProposeTransferCtrlOwnershipTx:()=>jt,buildStellarProposeTransferGovOwnTx:()=>er,buildStellarProposeUnpauseTx:()=>yr,buildStellarProposeUpdateDelayTx:()=>Zt,buildStellarProposeUpgradeControllerTx:()=>Ht,buildStellarProposeUpgradePoolParamsTx:()=>$t,buildStellarProposeUpgradePoolTx:()=>zt,buildStellarRenewAccountTx:()=>it,buildStellarRepayBatchTx:()=>F,buildStellarRepayDebtWithCollateralTx:()=>Y,buildStellarRepayTx:()=>j,buildStellarRevokeBlendPoolTx:()=>Je,buildStellarRevokeRoleTx:()=>ze,buildStellarRevokeTokenTx:()=>et,buildStellarSetAccumulatorTx:()=>Qe,buildStellarSetAggregatorTx:()=>Xe,buildStellarSetMarketOracleConfigTx:()=>rt,buildStellarSetOracleSanityBoundsTx:()=>ut,buildStellarSetOracleToleranceTx:()=>ot,buildStellarSetOracleTx:()=>tt,buildStellarSetPositionLimitsTx:()=>Ke,buildStellarSetPriceAggregatorTx:()=>Ve,buildStellarSetSpokeAssetFlagsTx:()=>nt,buildStellarSetSwapAggregatorTx:()=>je,buildStellarSupplyBatchTx:()=>G,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>J,buildStellarSwapDebtTx:()=>Z,buildStellarTransferOwnershipTx:()=>He,buildStellarUnpauseTx:()=>$e,buildStellarUpdateAccountThresholdTx:()=>ct,buildStellarUpdateIndexesTx:()=>at,buildStellarUpgradeControllerTx:()=>Ue,buildStellarUpgradeLiquidityPoolParamsTx:()=>st,buildStellarWithdrawBatchTx:()=>z,buildStellarWithdrawTx:()=>H,buildTx:()=>U,decodeStellarLendingEvent:()=>Lr,encodeAssetOracle:()=>Ne,encodeInterestRateModel:()=>qe,encodeMarketOracleConfigInput:()=>Be,encodeMarketParamsRaw:()=>_e,encodePositionLimits:()=>Pe,encodePriceKey:()=>ke,encodeStrategyPayloadToRouteXdr:()=>Fr,extractEventOrder:()=>Ur,getStellarAccountPositions:()=>he,getStellarAggregatorQuote:()=>zr,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>de,getStellarAssetGraph:()=>fe,getStellarAssetMarkets:()=>Se,getStellarAssetPage:()=>ce,getStellarAssets:()=>ue,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>Te,getStellarHub:()=>be,getStellarHubGraph:()=>ve,getStellarHubs:()=>ae,getStellarLendingContext:()=>oe,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>ne,getStellarQuoteTokens:()=>Hr,getStellarReserve:()=>se,getStellarReserveGraph:()=>we,getStellarReserveHolders:()=>pe,getStellarReserves:()=>le,getStellarSpoke:()=>ge,getStellarSpokeGraph:()=>xe,getStellarSpokes:()=>ie,getStellarUserActivity:()=>me,getStellarUserPositions:()=>ye,mapQuoteResponseToAggregatorSwap:()=>Kr,mapQuoteResponseToStrategyPayload:()=>Xr,mapQuoteResponseToStrategySwap:()=>Qr,mapSorobanError:()=>ao,mapStellarPositionActivityType:()=>Dr,prepareStellarBuiltTx:()=>eo,prepareStellarTxXdr:()=>Yr,stellarLendingDispatchKey:()=>Tr,stellarLendingRead:()=>Ae,syntheticEventOrder:()=>Gr,tagStellarInvokedContractError:()=>Jr,toBase64Xdr:()=>mr,toStellarPositionMode:()=>to});const o={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=o[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},g=1e6,y=e=>new c.Address(e).toScVal(),m=e=>new c.ScInt(e).toI128(),h=e=>c.xdr.ScVal.scvU32(e),T=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),f=e=>c.xdr.ScVal.scvBool(e),v=e=>c.xdr.ScVal.scvString(e),x=e=>c.xdr.ScVal.scvSymbol(e),w=()=>c.xdr.ScVal.scvVoid(),A=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(o)},_=(e,t)=>null==e?w():t(e),P=(e,t)=>E({asset:y(t),hub_id:h(e)}),k=(e,t,r)=>c.xdr.ScVal.scvVec([P(e,t),m(r)]),R=e=>c.xdr.ScVal.scvVec(e.map((e=>k(e.hubId,e.asset,e.amount)))),E=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:x(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)};class I{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>g)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(b[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const u=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(u>g)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const a=u===g;let i=g;n.forEach(((e,o)=>{r[e]=!0;const u=t[e];let l;if(o+1===n.length&&a)l=0;else{if(0===i)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(u.splitPpm*g/i);i-=Math.min(u.splitPpm,i),l=128+this.weight(e)}this.emitPath(u,l)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return Buffer.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const O=e=>{const t=new I(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=o,[a,i]=e.preSwapFromA?[n,u]:[u,n];t.emit(b.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(i))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return E({amounts:c.xdr.ScVal.scvVec(t.amountList.map((e=>m(e)))),assets:c.xdr.ScVal.scvVec(t.assetList.map((e=>y(e)))),ops:c.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},M=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},L=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),C=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},N=e=>{if("string"==typeof e)return M(C(e));if(e instanceof Uint8Array)return 0===e.length?L():M(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?M(C(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?M(C(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?M(C(e.bytes)):0===e.bytes.length?L():M(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!S.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>g)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==g)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(O(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},B=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function U(e,t,r){const o=e.controllerAddress??s(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function G(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return U(e,"supply",[y(e.caller),T(r),h(o),R([...t.assets])])}function D(e,t){return G(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function $(e,t){return U(e,"borrow",[y(e.caller),T(t.accountNonce),R([...t.borrows]),_(t.to,y)])}function W(e,t){return $(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function z(e,t){return U(e,"withdraw",[y(e.caller),T(t.accountNonce),R([...t.withdrawals]),_(t.to,y)])}function H(e,t){return z(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"repay",[y(e.caller),T(t.accountNonce),R([...t.payments])])}function j(e,t){return F(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function V(e,t){return U(e,"liquidate",[y(e.caller),T(t.accountNonce),R([...t.debtPayments])])}function X(e,t){return U(e,"flash_loan",[y(e.caller),P(t.hubId,t.asset),m(t.amount),y(t.receiver),B(t.data)])}function Q(e,t){return U(e,"migrate_from_blend",[y(e.caller),T(t.accountId),h(t.spokeId),h(t.hubId),y(t.blendPool),A(t.collateralTokens.map(y)),A(t.supplyTokens.map(y)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,c.xdr.ScVal.scvVec([y(t),m(r)]);var t,r}))))]);var r}function K(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return U(e,"multiply",[y(e.caller),T(r),h(o),P(t.collateral.hubId,t.collateral.asset),m(t.debtToFlashLoan),P(t.debt.hubId,t.debt.asset),h(t.mode),N(t.steps),_(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),_(t.convertSwap,N)])}function Z(e,t){return U(e,"swap_debt",[y(e.caller),T(t.accountNonce),P(t.existingDebt.hubId,t.existingDebt.asset),m(t.newDebtAmount),P(t.newDebt.hubId,t.newDebt.asset),N(t.steps)])}function J(e,t){return U(e,"swap_collateral",[y(e.caller),T(t.accountNonce),P(t.current.hubId,t.current.asset),m(t.fromAmount),P(t.newCollateral.hubId,t.newCollateral.asset),N(t.steps)])}function Y(e,t){return U(e,"repay_debt_with_collateral",[y(e.caller),T(t.accountNonce),P(t.collateral.hubId,t.collateral.asset),m(t.collateralAmount),P(t.debt.hubId,t.debt.asset),N(t.steps),f(t.closePosition)])}const ee="/stellar-lending",te=25,re=encodeURIComponent,oe=(e,t)=>e.fetchWithTimeout(`${ee}/context`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/live-state`,t),ue=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),ie=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),le=(e,t={},r)=>{const{hubId:o,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${ee}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},se=(e,t,r,o,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}`,n),pe=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/holders`,{...u,params:{side:n}}),de=(e,t,r)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}`,r),ce=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/page`,{...o,params:{...r}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/markets`,{...o,params:{side:r}}),be=(e,t,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,r),ge=(e,t,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,r),ye=(e,t,r)=>e.fetchWithTimeout(`${ee}/users/${re(t)}/positions`,r),me=(e,t,r={},o)=>{const{skip:n,top:u}=r;return e.fetchWithTimeout(`${ee}/users/${re(t)}/activity`,{...o,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},he=(e,t,r)=>e.fetchWithTimeout(`${ee}/accounts/${re(t)}/positions`,r),Te=(e,t={},r)=>{const{top:o=te,continuationToken:n}=t;return e.fetchWithTimeout(`${ee}/governance/proposals`,{...r,params:{top:o,...n?{continuationToken:n}:{}}})},fe=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/graph`,{...o,params:{...r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...o,params:{...r}}),xe=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...o,params:{...r}}),we=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/graph`,{...u,params:{...n}}),Ae=e=>({context:t=>oe(e,t),liveState:t=>ne(e,t),assets:t=>ue(e,t),hubs:t=>ae(e,t),spokes:t=>ie(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?le(e,t,r):le(e,{},t);var o},reserve:(t,r,o,n)=>se(e,t,r,o,n),reserveHolders:(t,r,o,n,u)=>pe(e,t,r,o,n,u),asset:(t,r)=>de(e,t,r),assetMarkets:(t,r,o)=>Se(e,t,r,o),hub:(t,r)=>be(e,t,r),spoke:(t,r)=>ge(e,t,r),userPositions:(t,r)=>ye(e,t,r),userActivity:(t,r,o)=>me(e,t,r,o),accountPositions:(t,r)=>he(e,t,r),governanceProposals:(t,r)=>Te(e,t,r),assetGraph:(t,r,o)=>fe(e,t,r,o),hubGraph:(t,r,o)=>ve(e,t,r,o),spokeGraph:(t,r,o)=>xe(e,t,r,o),reserveGraph:(t,r,o,n,u)=>we(e,t,r,o,n,u)}),qe=e=>E({base_borrow_rate:m(e.baseBorrowRateRay),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),_e=e=>E({asset_decimals:h(e.assetDecimals),asset_id:y(e.assetId),base_borrow_rate:m(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:f(e.isFlashloanable),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Pe=e=>E({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),ke=e=>{if("Token"in e&&e.Token)return A([x("Token"),y(e.Token)]);if("Ref"in e&&e.Ref)return A([x("Ref"),x(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Re=e=>{if("Stellar"in e)return A([x("Stellar"),y(e.Stellar)]);if("Symbol"in e)return A([x("Symbol"),x(e.Symbol)]);if("String"in e)return A([x("String"),v(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Ee=e=>{if("Spot"===e)return A([x("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return A([x("Twap"),h(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Ie=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Oe=e=>{if("Market"===e||"Fundamental"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Me=e=>{if("Reflector"in e){const t=e.Reflector;return A([x("Reflector"),E({asset:Re(t.asset),contract:y(t.contract),read_mode:Ee(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return A([x("MultiFeed"),E({contract:y(t.contract),feed_id:v(t.feedId),kind:Ie(t.kind),nature:Oe(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},Le=e=>{const t=e;return E({decimals:h(t.decimals),max_stale_seconds:T(t.maxStaleSeconds),provider:Me(t.provider)})},Ce=e=>{if("RequireDisjoint"===e)return A([x("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return A([x("AllowShared"),A(t.map((e=>E({contract:y(e.contract),kind:Ie(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},Ne=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return E({asset_decimals:h(Number(t.assetDecimals)),independence:Ce(t.independence),max_price_stale_seconds:T(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:m(String(t.maxSanityPriceWad)),min_sanity_price_wad:m(String(t.minSanityPriceWad)),sources:A(r.map((e=>(e=>{if("Feed"in e)return A([x("Feed"),Le(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return A([x("Scaled"),E({factor:Le(t.factor),max_factor_wad:m(t.maxFactorWad),min_factor_wad:m(t.minFactorWad),quote:ke(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return A([x("LpShare"),E({key_a:ke(t.keyA),key_b:ke(t.keyB),kind:A([x(t.kind||"ConstantProduct")]),pool:y(t.pool),reserve_a_decimals:h(t.reserveADecimals),reserve_b_decimals:h(t.reserveBDecimals),share_decimals:h(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})},Be=Ne;function Ue(e,t){return U(e,"upgrade",[q(t.wasmHash)])}function Ge(e,t){return U(e,"migrate",[h(t.newVersion)])}function De(e){return U(e,"pause",[])}function $e(e){return U(e,"unpause",[])}function We(e,t){return U(e,"grant_role",[y(t.account),x(t.role)])}function ze(e,t){return U(e,"revoke_role",[y(t.account),x(t.role)])}function He(e,t){return U(e,"transfer_ownership",[y(t.newOwner),h(t.liveUntilLedger)])}function Fe(e){return U(e,"accept_ownership",[])}function je(e,t){return U(e,"set_swap_aggregator",[y(t.aggregator)])}function Ve(e,t){return U(e,"set_price_aggregator",[y(t.aggregator)])}const Xe=je;function Qe(e,t){return U(e,"set_accumulator",[y(t.accumulator)])}function Ke(e,t){return U(e,"set_position_limits",[Pe(t)])}function Ze(e,t){return U(e,"approve_blend_pool",[y(t.pool)])}function Je(e,t){return U(e,"revoke_blend_pool",[y(t.pool)])}const Ye=Ze,et=Je;function tt(e,t){return U(e,"set_oracle",[ke(t.key),Ne(t.oracle)])}const rt=tt;function ot(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[ke(t.key),E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function nt(e,t){return U(e,"set_spoke_asset_flags",[h(t.spokeId),P(t.hubId,t.asset),f(t.paused),f(t.frozen)])}function ut(e,t){return U(e,"set_oracle_sanity_bounds",[y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function at(e,t){return U(e,"update_indexes",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function it(e,t){return U(e,"renew_account",[y(e.caller),T(t.accountNonce)])}function lt(e,t){return U(e,"create_liquidity_pool",[h(t.hubId),y(t.asset),_e(t.params)])}function st(e,t){return U(e,"upgrade_liquidity_pool_params",[P(t.hubId,t.asset),qe(t.params)])}function pt(e,t){return U(e,"claim_revenue",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function dt(e,t){return U(e,"add_rewards",[y(e.caller),R(t.rewards)])}function ct(e,t){return U(e,"update_account_threshold",[y(e.caller),f(t.hasRisks),A(t.accountNonces.map((e=>T(e))))])}const St="00".repeat(32),bt=e=>{if("string"==typeof e)return q(e);const t=Buffer.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return c.xdr.ScVal.scvBytes(t)},gt=(e,...t)=>A([x(e),...t]),yt=e=>E({new_owner:y(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),mt=e=>E({asset:y(e.asset),bonus:h(e.bonus),borrow_cap:m(e.borrowCap),can_borrow:f(e.canBorrow),can_collateral:f(e.canCollateral),frozen:f(e.frozen),hub_id:h(e.hubId),paused:f(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),oracle_override:A([x("None")]),spoke_id:h(e.spokeId),supply_cap:m(e.supplyCap),threshold:h(e.threshold)}),ht=e=>E({account:y(e.account),role:x(e.role)});function Tt(e,t,r){const o=e.governanceAddress??d(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ft=(e,t,r)=>Tt(e,"propose",[y(e.caller),t,bt(r)]),vt=(e,t,r)=>Tt(e,"execute_self",[w(),t,bt(r)]);function xt(e,t,r){return ft(e,gt("SetSwapAggregator",y(t.aggregator)),r)}function wt(e,t,r){return ft(e,gt("SetPriceAggregator",y(t.aggregator)),r)}const At=xt;function qt(e,t,r){return ft(e,gt("SetAccumulator",y(t.accumulator)),r)}function _t(e,t,r){return ft(e,gt("SetPositionLimits",Pe(t)),r)}function Pt(e,t){return ft(e,gt("CreateHub"),t)}function kt(e,t){return ft(e,gt("AddSpoke"),t)}function Rt(e,t,r){return ft(e,gt("RemoveSpoke",h(t.spokeId)),r)}function Et(e,t,r){return ft(e,gt("AddAssetToSpoke",mt(t)),r)}function It(e,t,r){return ft(e,gt("EditAssetInSpoke",mt(t)),r)}function Ot(e,t,r){return ft(e,gt("RemoveAssetFromSpoke",E({hub_asset:P((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function Mt(e,t,r){return ft(e,gt("SetSpokeLiquidationCurve",E({hf_for_max_bonus_wad:m((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:h(o.liquidationBonusFactorBps),spoke_id:h(o.spokeId),target_hf_wad:m(o.targetHfWad)})),r);var o}function Lt(e,t,r){return ft(e,gt("SetPositionManager",y(t.manager),f(t.isActive)),r)}function Ct(e,t,r){return ft(e,gt("SetMinBorrowCollateralUsd",m(t.floorWad)),r)}function Nt(e,t,r){return ft(e,gt("ApproveToken",y(t.token)),r)}function Bt(e,t,r){return ft(e,gt("RevokeToken",y(t.token)),r)}function Ut(e,t,r){return ft(e,gt("ApproveBlendPool",y(t.pool)),r)}function Gt(e,t,r){return ft(e,gt("RevokeBlendPool",y(t.pool)),r)}function Dt(e,t,r){return ft(e,gt("CreateLiquidityPool",E({asset:y((o=t).asset),hub_id:h(o.hubId),params:_e(o.params)})),r);var o}function $t(e,t,r){return ft(e,gt("UpgradeLiquidityPoolParams",E({hub_asset:P((o=t).hubId,o.asset),params:qe(o.params)})),r);var o}function Wt(e,t,r){return ft(e,gt("DeployPool",q(t.wasmHash)),r)}function zt(e,t,r){return ft(e,gt("UpgradePool",q(t.wasmHash)),r)}function Ht(e,t,r){return ft(e,gt("UpgradeController",q(t.wasmHash)),r)}function Ft(e,t,r){return ft(e,gt("MigrateController",h(t.newVersion)),r)}function jt(e,t,r){return ft(e,gt("TransferCtrlOwnership",yt(t)),r)}function Vt(e,t,r){return ft(e,gt("ConfigureAssetOracle",E({key:ke((o=t).key),oracle:Ne(o.oracle)})),r);var o}const Xt=Vt;function Qt(e,t,r){return ft(e,gt("EditOracleTolerance",E({key:ke((o=t).key),tolerance:h(o.tolerance)})),r);var o}function Kt(e,t,r){return ft(e,gt("UpgradeGov",q(t.wasmHash)),r)}function Zt(e,t,r){return ft(e,gt("UpdateGovDelay",h(t.newDelay)),r)}function Jt(e,t,r){return ft(e,gt("GrantGovRole",ht(t)),r)}function Yt(e,t,r){return ft(e,gt("RevokeGovRole",ht(t)),r)}function er(e,t,r){return ft(e,gt("TransferGovOwnership",yt(t)),r)}function tr(e,t){const r=A(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),o=bt(t.predecessor??St);return Tt(e,"execute",[w(),y(t.target),x(t.functionName),r,o,bt(t.salt)])}function rr(e,t,r){return vt(e,gt("UpgradeGov",q(t.wasmHash)),r)}function or(e,t,r){return vt(e,gt("UpdateGovDelay",h(t.newDelay)),r)}function nr(e,t,r){return vt(e,gt("GrantGovRole",ht(t)),r)}function ur(e,t,r){return vt(e,gt("RevokeGovRole",ht(t)),r)}function ar(e,t,r){return vt(e,gt("TransferGovOwnership",yt(t)),r)}const ir=e=>A(e.map(y));function lr(e,t,r){return Tt(e,"propose_canceller_reset",[ir(t.newCancellers),bt(r)])}function sr(e,t,r){return Tt(e,"execute_canceller_reset",[_(t.executor,y),ir(t.newCancellers),bt(r)])}function pr(e,t){return Tt(e,"set_spoke_asset_flags",[y(e.caller),h(t.spokeId),P(t.hubId,t.asset),f(t.paused),f(t.frozen)])}function dr(e,t){return Tt(e,"set_oracle_sanity_bounds",[y(e.caller),y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function cr(e){return Tt(e,"create_hub",[y(e.caller)])}function Sr(e){return Tt(e,"add_spoke",[y(e.caller)])}function br(e,t){return Tt(e,"revoke_role_immediate",[y(t.account),x(t.role)])}function gr(e){return Tt(e,"pause",[y(e.caller)])}function yr(e,t){return ft(e,gt("Unpause"),t)}const mr=e=>e.toXDR("base64"),hr=e=>c.xdr.ScVal.fromXDR(e,"base64"),Tr=e=>e.map((e=>String((0,c.scValToNative)(hr(e))))).join(":"),fr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),vr=e=>Number(e),xr=e=>String(e),wr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Ar=["None","Multiply","Long","Short"],qr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net"],_r=e=>Array.isArray(e)?e:[],Pr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],qr[vr(o)]??fr(o)),positionType:t,hubId:vr(e[1]),asset:xr(e[2]),scaledAmountRay:fr(e[3]),indexRay:fr(e[4]),amount:fr(e[5]),liquidationThresholdBps:r?void 0:vr(e[6]),liquidationBonusBps:r?void 0:vr(e[7]),loanToValueBps:r?void 0:vr(e[8]),liquidationFeesBps:r?void 0:vr(e[9])};var o},kr=e=>{return{owner:xr(e[0]),spokeId:vr(e[1]),mode:(t=e[2],Ar[vr(t)]??"None")};var t},Rr=e=>Array.isArray(e)?e[1]:void 0,Er=e=>{const t=(r=e,Array.isArray(r)?xr(r[0]):xr(r));var r;if("Token"===t)return{Token:xr(Rr(e))};if("Ref"===t)return{Ref:xr(Rr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:xr(t.Token)};if(void 0!==t.Ref)return{Ref:xr(t.Ref)}}return{Token:xr(e)}},Ir=e=>{const t=e.tolerance??{};return{assetDecimals:vr(e.asset_decimals),maxPriceStaleSeconds:vr(e.max_price_stale_seconds),sources:_r(e.sources).map((e=>e)),tolerance:{upperRatio:vr(t.upper_ratio_bps),lowerRatio:vr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:fr(e.min_sanity_price_wad),maxSanityPriceWad:fr(e.max_sanity_price_wad)}},Or={"market:create":e=>({topic:"market:create",data:{hubId:vr(e.hub_id),baseAsset:xr(e.base_asset),maxBorrowRate:fr(e.max_borrow_rate),baseBorrowRate:fr(e.base_borrow_rate),slope1:fr(e.slope1),slope2:fr(e.slope2),slope3:fr(e.slope3),midUtilization:fr(e.mid_utilization),optimalUtilization:fr(e.optimal_utilization),maxUtilization:fr(e.max_utilization),reserveFactor:vr(e.reserve_factor),marketAddress:xr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:xr(e.asset),maxBorrowRateRay:fr(e.max_borrow_rate),baseBorrowRateRay:fr(e.base_borrow_rate),slope1Ray:fr(e.slope1),slope2Ray:fr(e.slope2),slope3Ray:fr(e.slope3),midUtilizationRay:fr(e.mid_utilization),optimalUtilizationRay:fr(e.optimal_utilization),maxUtilizationRay:fr(e.max_utilization),reserveFactorBps:vr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:_r(e).map((e=>{return t=_r(e),{hubId:vr(t[0]),asset:xr(t[1]),timestamp:vr(t[2]),supplyIndexRay:fr(t[3]),borrowIndexRay:fr(t[4]),cash:fr(t[5]),suppliedRay:fr(t[6]),borrowedRay:fr(t[7]),revenueRay:fr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:_r(e).map((e=>{const t=e;return{hubId:vr(t.hub_id),asset:xr(t.asset),params:(r=t.params,{maxBorrowRateRay:fr(r.max_borrow_rate),baseBorrowRateRay:fr(r.base_borrow_rate),slope1Ray:fr(r.slope1),slope2Ray:fr(r.slope2),slope3Ray:fr(r.slope3),midUtilizationRay:fr(r.mid_utilization),optimalUtilizationRay:fr(r.optimal_utilization),maxUtilizationRay:fr(r.max_utilization),reserveFactorBps:vr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:vr(r.flashloan_fee),assetId:xr(r.asset_id),assetDecimals:vr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=_r(e);return{topic:"position:batch_update",data:{accountId:fr(t[0]),accountAttributes:kr(_r(t[1])),updates:[..._r(t[2]).map((e=>Pr(_r(e),"Deposit"))),..._r(t[3]).map((e=>Pr(_r(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:vr(e.hub_id),asset:xr(e.asset),receiver:xr(e.receiver),caller:xr(e.caller),amount:fr(e.amount),fee:fr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Er(e.key),oracle:Ir(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:xr(e.asset),oracle:Ir(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:xr(e.liquidator),accountId:fr(e.account_id),repaidUsdWad:fr(e.repaid_usd_wad),bonusBps:fr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:fr(e.account_id),totalBorrowUsdWad:fr(e.total_borrow_usd_wad),totalCollateralUsdWad:fr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:xr(e.token),amount:fr(e.amount),usdValueWad:fr(e.usd_value_wad),accountId:fr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:vr(e.hub_id),asset:xr(e.asset),amount:fr(e.amount),fee:fr(e.fee),amountSent:fr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:xr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:wr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:xr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:xr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:xr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:xr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:wr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:vr(e.max_supply_positions),maxBorrowPositions:vr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:fr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:xr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:vr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:fr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:fr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:vr(t.liquidation_bonus_factor_bps)}}}},Mr=Object.freeze(Object.keys(Or));function Lr(e,t){const r=Tr(e),o=Or[r];return o?o((0,c.scValToNative)(hr(t))):null}const Cr="XLENDXLM-a7c9f3",Nr=1e4;function Br(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${Cr}-${r}`}function Ur(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Gr(e,t=0){return e*Nr+t}function Dr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const $r=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Wr=e=>e.baseUrl??i[e.network];async function zr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=$r(Wr(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function Hr(e){const t=$r(Wr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Fr=e=>O(e).toXDR("base64");function jr(e,t){const r=e.routerAddress??p(e.network),o=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence),u=N(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",y(e.caller),m(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Vr(e,t){return jr(e,t)}function Xr(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(Zr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Zr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Qr(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Xr(e,t)}const Kr=Xr,Zr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Jr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Yr(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Jr(r.invokedContractId,e);throw e}}async function eo(e,t,r){return Yr(e,t.xdr,r)}function to(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function ro(e,t){return new Uint8Array(0)}const oo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(t,"hex")};function no(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(oo(e.message)),c.xdr.ScVal.scvBytes(oo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const uo={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function ao(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=uo[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>m.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>m.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>m.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>m.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>m.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>m.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>m.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>m.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>m.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>m.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>m.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>m.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>m.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>m.buildStellarApproveBlendPoolTx,buildStellarApproveTokenTx:()=>m.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>m.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>m.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>m.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>m.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>m.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>m.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>m.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>m.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>m.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>m.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>m.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>m.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>m.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>m.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>m.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>m.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>m.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>m.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>m.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>m.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>m.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>m.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>m.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>m.buildStellarMigrateTx,buildStellarMultiplyTx:()=>m.buildStellarMultiplyTx,buildStellarPauseTx:()=>m.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>m.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>m.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>m.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>m.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>m.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>m.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeConfigureMarketOracleTx:()=>m.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>m.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>m.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>m.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>m.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>m.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>m.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>m.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>m.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>m.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>m.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>m.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>m.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>m.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>m.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>m.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>m.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>m.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>m.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>m.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>m.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>m.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>m.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>m.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>m.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>m.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>m.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>m.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>m.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>m.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>m.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>m.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>m.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>m.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>m.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>m.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>m.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>m.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>m.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>m.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>m.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>m.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>m.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>m.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>m.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>m.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>m.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>m.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>m.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>m.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>m.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>m.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>m.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>m.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>m.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>m.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>m.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>m.buildStellarWithdrawTx,buildTx:()=>m.buildTx,decodeStellarLendingEvent:()=>m.decodeStellarLendingEvent,encodeAssetOracle:()=>m.encodeAssetOracle,encodeInterestRateModel:()=>m.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>m.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>m.encodeMarketParamsRaw,encodePositionLimits:()=>m.encodePositionLimits,encodePriceKey:()=>m.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>m.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>m.extractEventOrder,getStellarAccountPositions:()=>m.getStellarAccountPositions,getStellarAggregatorQuote:()=>m.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>m.getStellarAggregatorRouter,getStellarAsset:()=>m.getStellarAsset,getStellarAssetGraph:()=>m.getStellarAssetGraph,getStellarAssetMarkets:()=>m.getStellarAssetMarkets,getStellarAssetPage:()=>m.getStellarAssetPage,getStellarAssets:()=>m.getStellarAssets,getStellarGovernance:()=>m.getStellarGovernance,getStellarGovernanceProposals:()=>m.getStellarGovernanceProposals,getStellarHub:()=>m.getStellarHub,getStellarHubGraph:()=>m.getStellarHubGraph,getStellarHubs:()=>m.getStellarHubs,getStellarLendingContext:()=>m.getStellarLendingContext,getStellarLendingController:()=>m.getStellarLendingController,getStellarLendingLiveState:()=>m.getStellarLendingLiveState,getStellarQuoteTokens:()=>m.getStellarQuoteTokens,getStellarReserve:()=>m.getStellarReserve,getStellarReserveGraph:()=>m.getStellarReserveGraph,getStellarReserveHolders:()=>m.getStellarReserveHolders,getStellarReserves:()=>m.getStellarReserves,getStellarSpoke:()=>m.getStellarSpoke,getStellarSpokeGraph:()=>m.getStellarSpokeGraph,getStellarSpokes:()=>m.getStellarSpokes,getStellarUserActivity:()=>m.getStellarUserActivity,getStellarUserPositions:()=>m.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>m.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>m.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>m.mapQuoteResponseToStrategySwap,mapSorobanError:()=>m.mapSorobanError,mapStellarPositionActivityType:()=>m.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>m.prepareStellarBuiltTx,prepareStellarTxXdr:()=>m.prepareStellarTxXdr,stellarLendingDispatchKey:()=>m.stellarLendingDispatchKey,stellarLendingRead:()=>m.stellarLendingRead,syntheticEventOrder:()=>m.syntheticEventOrder,tagStellarInvokedContractError:()=>m.tagStellarInvokedContractError,toBase64Xdr:()=>m.toBase64Xdr,toStellarPositionMode:()=>m.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...r}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=r,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=r,S=p?.Authorization,b="Bearer undefined"===S?void 0:S,g={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...b?{Authorization:b}:{}},y=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),m=`${this.apiUrl}${e}${y.length?`?${y}`:""}`,{revalidate:h,...T}=o??{},{revalidate:f,...v}=i??{},x="GET"!==d||b?void 0:f??h,w="GET"!==d||b||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(g).length?{headers:g}:{},cache:w,next:{...T,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",m,A);const q=await fetch(m,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${m}: ${e.message}`),{cause:e});throw e})),_=await q.text();if(!q.ok){let e;try{e=JSON.parse(_)}catch{e={message:_}}const t=[m,q.status,q.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(_)}catch{return _}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||r},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||r};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const b=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),g={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},y=["PATCH","POST","DELETE","PUT"];var m=r(397);const h=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),T=()=>({static:{},params:{},leaves:[]});function f(e,t,r,o){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...r,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!b(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:y,method:m,headers:h,cache:T,next:f,debug:v,continuationToken:x,...w}=d,A=y?`Bearer ${y}`:void 0,q={...h,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},_={...f,tags:[...f?.tags??[],u]};return o.fetchWithTimeout(u,{method:m,params:w,body:g,headers:q,cache:T,debug:v,..._?{next:_}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))y.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=T();for(const[t,r]of Object.entries(g)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=h(e.slice(1));n=n.params[t]||=T()}else{const t=h(e);n=n.static[t]||=T()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:r,def:n}=t.leaves[0];i=f(r,n,o,e)}else{i={};for(const{rawPath:r,def:n}of t.leaves)i[h(r.split("/").pop().replace(/^:/,""))]=f(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),u=r)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=r(n,{...o,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],r=(...e)=>t(...e);return Object.assign(r,t)}return u};if(i[e]){const r=i[e];i[e]=e=>({...r(e),...t(e)})}else i[e]=t}return i};return r(t,{})}module.exports=o})();
|