@xoxno/sdk-js 1.0.209 → 1.0.211

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/README.md CHANGED
@@ -1182,5 +1182,5 @@ sdk.user.me.event.badge(...); // string
1182
1182
  sdk.user.me.event.badge.payload(...); // BageQRData
1183
1183
 
1184
1184
  // GET /user/blend/:address
1185
- sdk.user.blend.address("...")(...); // BlendUserPosition
1185
+ sdk.user.blend.address("...")(...); // BlendUserPosition[]
1186
1186
  ```
@@ -2152,7 +2152,7 @@ export declare const endpoints: {
2152
2152
  };
2153
2153
  readonly "/user/blend/:address": {
2154
2154
  readonly input: {};
2155
- readonly output: BlendUserPosition;
2155
+ readonly output: BlendUserPosition[];
2156
2156
  };
2157
2157
  readonly "/stellar/aggregator/quote": {
2158
2158
  readonly input: {
@@ -0,0 +1,2 @@
1
+ /** Pins the identifier shapes the SDK accepts, per chain. */
2
+ export {};
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:()=>Tt,STELLAR_LENDING_CONTROLLER:()=>o,STELLAR_LENDING_TOPICS:()=>$r,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Wr,buildSameTokenRepaySwapSteps:()=>lo,buildStellarAcceptOwnershipTx:()=>Je,buildStellarAddRewardsTx:()=>ft,buildStellarApproveBlendPoolTx:()=>nt,buildStellarApproveTokenTx:()=>at,buildStellarBatchSwapTx:()=>Yr,buildStellarBorrowBatchTx:()=>W,buildStellarBorrowTx:()=>z,buildStellarCctpForwardTx:()=>po,buildStellarClaimRevenueTx:()=>mt,buildStellarCreateLiquidityPoolTx:()=>bt,buildStellarExecuteCancellerResetTx:()=>yr,buildStellarExecuteStrategyTx:()=>Jr,buildStellarFlashLoanTx:()=>Z,buildStellarGovernanceAddSpokeImmediateTx:()=>Tr,buildStellarGovernanceCreateHubImmediateTx:()=>hr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>sr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>dr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>cr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Sr,buildStellarGovernanceExecuteTx:()=>lr,buildStellarGovernanceExecuteUpdateDelayTx:()=>pr,buildStellarGovernancePauseTx:()=>xr,buildStellarGovernanceRevokeRoleImmediateTx:()=>vr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>fr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>mr,buildStellarGrantRoleTx:()=>Qe,buildStellarLendingIdentifier:()=>zr,buildStellarLiquidateTx:()=>X,buildStellarMigrateFromBlendTx:()=>K,buildStellarMigrateTx:()=>je,buildStellarMultiplyTx:()=>J,buildStellarPauseTx:()=>Ve,buildStellarProposeAddAssetToSpokeTx:()=>Ut,buildStellarProposeAddSpokeTx:()=>Lt,buildStellarProposeApproveBlendPoolTx:()=>Ft,buildStellarProposeApproveTokenTx:()=>zt,buildStellarProposeCancellerResetTx:()=>br,buildStellarProposeConfigureAssetOracleTx:()=>er,buildStellarProposeConfigureMarketOracleTx:()=>tr,buildStellarProposeCreateHubTx:()=>Ct,buildStellarProposeCreateLiquidityPoolTx:()=>Vt,buildStellarProposeDeployPoolTx:()=>Qt,buildStellarProposeEditAssetInSpokeTx:()=>Gt,buildStellarProposeEditOracleToleranceTx:()=>rr,buildStellarProposeGovernanceUpgradeTx:()=>or,buildStellarProposeGrantGovernanceRoleTx:()=>ur,buildStellarProposeMigrateControllerTx:()=>Jt,buildStellarProposeRemoveAssetFromSpokeTx:()=>Nt,buildStellarProposeRemoveSpokeTx:()=>Bt,buildStellarProposeRevokeBlendPoolTx:()=>jt,buildStellarProposeRevokeGovernanceRoleTx:()=>ar,buildStellarProposeRevokeTokenTx:()=>Ht,buildStellarProposeSetAccumulatorTx:()=>Ot,buildStellarProposeSetAggregatorTx:()=>It,buildStellarProposeSetMinBorrowCollatTx:()=>Wt,buildStellarProposeSetPositionLimitsTx:()=>Mt,buildStellarProposeSetPositionManagerTx:()=>Dt,buildStellarProposeSetPriceAggregatorTx:()=>Et,buildStellarProposeSetSpokeLiquidationCurveTx:()=>$t,buildStellarProposeSetSwapAggregatorTx:()=>Rt,buildStellarProposeTransferCtrlOwnershipTx:()=>Yt,buildStellarProposeTransferGovOwnTx:()=>ir,buildStellarProposeUnpauseTx:()=>wr,buildStellarProposeUpdateDelayTx:()=>nr,buildStellarProposeUpgradeControllerTx:()=>Kt,buildStellarProposeUpgradePoolParamsTx:()=>Xt,buildStellarProposeUpgradePoolTx:()=>Zt,buildStellarRenewAccountTx:()=>gt,buildStellarRepayBatchTx:()=>j,buildStellarRepayDebtWithCollateralTx:()=>te,buildStellarRepayTx:()=>V,buildStellarRevokeBlendPoolTx:()=>ut,buildStellarRevokeRoleTx:()=>Ze,buildStellarRevokeTokenTx:()=>it,buildStellarSetAccumulatorTx:()=>rt,buildStellarSetAggregatorTx:()=>tt,buildStellarSetMarketOracleConfigTx:()=>st,buildStellarSetOracleSanityBoundsTx:()=>ct,buildStellarSetOracleToleranceTx:()=>pt,buildStellarSetOracleTx:()=>lt,buildStellarSetPositionLimitsTx:()=>ot,buildStellarSetPriceAggregatorTx:()=>et,buildStellarSetSpokeAssetFlagsTx:()=>dt,buildStellarSetSwapAggregatorTx:()=>Ye,buildStellarSupplyBatchTx:()=>$,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>ee,buildStellarSwapDebtTx:()=>Y,buildStellarTransferOwnershipTx:()=>Ke,buildStellarUnpauseTx:()=>Xe,buildStellarUpdateAccountThresholdTx:()=>ht,buildStellarUpdateIndexesTx:()=>St,buildStellarUpgradeControllerTx:()=>Fe,buildStellarUpgradeLiquidityPoolParamsTx:()=>yt,buildStellarWithdrawBatchTx:()=>H,buildStellarWithdrawTx:()=>F,buildTx:()=>N,decodeStellarLendingEvent:()=>Dr,decodeStellarLiquidateReturn:()=>Q,encodeAssetOracle:()=>ze,encodeInterestRateModel:()=>Oe,encodeMarketOracleConfigInput:()=>He,encodeMarketParamsRaw:()=>Me,encodePositionLimits:()=>Ce,encodePriceKey:()=>Le,encodeStrategyPayloadToRouteXdr:()=>Kr,extractEventOrder:()=>Hr,getStellarAccountDelegates:()=>Re,getStellarAccountPositions:()=>Te,getStellarAggregatorQuote:()=>Qr,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>Se,getStellarAssetGraph:()=>xe,getStellarAssetMarkets:()=>be,getStellarAssetPage:()=>ge,getStellarAssets:()=>ie,getStellarBlendPools:()=>Ee,getStellarContractConfig:()=>Pe,getStellarContractRoles:()=>ke,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ve,getStellarHub:()=>ye,getStellarHubGraph:()=>we,getStellarHubs:()=>le,getStellarLendingContext:()=>ue,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>ae,getStellarProtocolConfig:()=>_e,getStellarQuoteTokens:()=>Zr,getStellarReserve:()=>de,getStellarReserveGraph:()=>qe,getStellarReserveHolders:()=>ce,getStellarReserves:()=>pe,getStellarSpoke:()=>me,getStellarSpokeGraph:()=>Ae,getStellarSpokes:()=>se,getStellarUserActivity:()=>he,getStellarUserPositions:()=>fe,mapQuoteResponseToAggregatorSwap:()=>ro,mapQuoteResponseToStrategyPayload:()=>eo,mapQuoteResponseToStrategySwap:()=>to,mapSorobanError:()=>So,mapStellarPositionActivityType:()=>jr,prepareStellarBuiltTx:()=>ao,prepareStellarTxXdr:()=>uo,stellarLendingDispatchKey:()=>_r,stellarLendingRead:()=>Ie,syntheticEventOrder:()=>Fr,tagStellarInvokedContractError:()=>no,toBase64Xdr:()=>Ar,toStellarPositionMode:()=>io});const o={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=o[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],g={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},b=1e6,y=e=>new c.Address(e).toScVal(),m=e=>new c.ScInt(e).toI128(),f=e=>c.xdr.ScVal.scvU32(e),h=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),T=e=>c.xdr.ScVal.scvBool(e),v=e=>c.xdr.ScVal.scvString(e),x=e=>c.xdr.ScVal.scvSymbol(e),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)=>I({asset:y(t),hub_id:f(e)}),k=(e,t,r)=>c.xdr.ScVal.scvVec([P(e,t),m(r)]),R=e=>c.xdr.ScVal.scvVec(e.map((e=>k(e.hubId,e.asset,e.amount)))),E=e=>{if("Transfer"===e)return A([x("Transfer")]);if(e&&"object"==typeof e&&"Credit"in e){const t=e.Credit;if("number"==typeof t&&!Number.isInteger(t))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${t}`);return A([x("Credit"),h(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},I=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 O{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>b)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(g[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const u=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(u>b)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const a=u===b;let i=b;n.forEach(((e,o)=>{r[e]=!0;const u=t[e];let l;if(o+1===n.length&&a)l=0;else{if(0===i)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(u.splitPpm*b/i);i-=Math.min(u.splitPpm,i),l=128+this.weight(e)}this.emitPath(u,l)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return Buffer.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const M=e=>{const t=new O(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=o,[a,i]=e.preSwapFromA?[n,u]:[u,n];t.emit(g.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(i))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return I({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))})},C=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)),B=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},U=e=>{if("string"==typeof e)return C(B(e));if(e instanceof Uint8Array)return 0===e.length?L():C(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?C(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?C(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?C(B(e.bytes)):0===e.bytes.length?L():C(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!S.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(M(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},G=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 N(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 $(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return N(e,"supply",[y(e.caller),h(r),f(o),R([...t.assets])])}function D(e,t){return $(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function W(e,t){return N(e,"borrow",[y(e.caller),h(t.accountNonce),R([...t.borrows]),_(t.to,y)])}function z(e,t){return W(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function H(e,t){return N(e,"withdraw",[y(e.caller),h(t.accountNonce),R([...t.withdrawals]),_(t.to,y)])}function F(e,t){return H(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function j(e,t){return N(e,"repay",[y(e.caller),h(t.accountNonce),R([...t.payments])])}function V(e,t){return j(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function X(e,t){return N(e,"liquidate",[y(e.caller),h(t.accountNonce),R([...t.debtPayments]),E(t.seizeMode??"Transfer")])}function Q(e){const t=(0,c.scValToNative)(c.xdr.ScVal.fromXDR(e,"base64"));if("bigint"==typeof t||"number"==typeof t)return t.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof t)}function Z(e,t){return N(e,"flash_loan",[y(e.caller),P(t.hubId,t.asset),m(t.amount),y(t.receiver),G(t.data)])}function K(e,t){return N(e,"migrate_from_blend",[y(e.caller),h(t.accountId),f(t.spokeId),f(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 J(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return N(e,"multiply",[y(e.caller),h(r),f(o),P(t.collateral.hubId,t.collateral.asset),m(t.debtToFlashLoan),P(t.debt.hubId,t.debt.asset),f(t.mode),U(t.steps),_(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),_(t.convertSwap,U)])}function Y(e,t){return N(e,"swap_debt",[y(e.caller),h(t.accountNonce),P(t.existingDebt.hubId,t.existingDebt.asset),m(t.newDebtAmount),P(t.newDebt.hubId,t.newDebt.asset),U(t.steps)])}function ee(e,t){return N(e,"swap_collateral",[y(e.caller),h(t.accountNonce),P(t.current.hubId,t.current.asset),m(t.fromAmount),P(t.newCollateral.hubId,t.newCollateral.asset),U(t.steps)])}function te(e,t){return N(e,"repay_debt_with_collateral",[y(e.caller),h(t.accountNonce),P(t.collateral.hubId,t.collateral.asset),m(t.collateralAmount),P(t.debt.hubId,t.debt.asset),U(t.steps),T(t.closePosition)])}const re="/stellar-lending",oe=25,ne=encodeURIComponent,ue=(e,t)=>e.fetchWithTimeout(`${re}/context`,t),ae=(e,t)=>e.fetchWithTimeout(`${re}/live-state`,t),ie=(e,t)=>e.fetchWithTimeout(`${re}/assets`,t),le=(e,t)=>e.fetchWithTimeout(`${re}/hubs`,t),se=(e,t)=>e.fetchWithTimeout(`${re}/spokes`,t),pe=(e,t={},r)=>{const{hubId:o,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${re}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},de=(e,t,r,o,n)=>e.fetchWithTimeout(`${re}/reserves/${t}/${r}/${ne(o)}`,n),ce=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${re}/reserves/${t}/${r}/${ne(o)}/holders`,{...u,params:{side:n}}),Se=(e,t,r)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}`,r),ge=(e,t,r,o)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}/page`,{...o,params:{...r}}),be=(e,t,r,o)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}/markets`,{...o,params:{side:r}}),ye=(e,t,r)=>e.fetchWithTimeout(`${re}/hubs/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${re}/spokes/${t}`,r),fe=(e,t,r)=>e.fetchWithTimeout(`${re}/users/${ne(t)}/positions`,r),he=(e,t,r={},o)=>{const{skip:n,top:u}=r;return e.fetchWithTimeout(`${re}/users/${ne(t)}/activity`,{...o,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},Te=(e,t,r)=>e.fetchWithTimeout(`${re}/accounts/${ne(t)}/positions`,r),ve=(e,t={},r)=>{const{top:o=oe,continuationToken:n}=t;return e.fetchWithTimeout(`${re}/governance/proposals`,{...r,params:{top:o,...n?{continuationToken:n}:{}}})},xe=(e,t,r,o)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}/graph`,{...o,params:{...r}}),we=(e,t,r,o)=>e.fetchWithTimeout(`${re}/hubs/${t}/graph`,{...o,params:{...r}}),Ae=(e,t,r,o)=>e.fetchWithTimeout(`${re}/spokes/${t}/graph`,{...o,params:{...r}}),qe=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${re}/reserves/${t}/${r}/${ne(o)}/graph`,{...u,params:{...n}}),_e=(e,t)=>e.fetchWithTimeout(`${re}/protocol-config`,t),Pe=(e,t,r)=>e.fetchWithTimeout(`${re}/protocol-config/${ne(t)}`,r),ke=(e,t,r)=>e.fetchWithTimeout(t?`${re}/roles?contractAddress=${ne(t)}`:`${re}/roles`,r),Re=(e,t,r)=>e.fetchWithTimeout(`${re}/accounts/${ne(String(t))}/delegates`,r),Ee=(e,t)=>e.fetchWithTimeout(`${re}/blend-pools`,t),Ie=e=>({context:t=>ue(e,t),liveState:t=>ae(e,t),protocolConfig:t=>_e(e,t),contractConfig:(t,r)=>Pe(e,t,r),contractRoles:(t,r)=>ke(e,t,r),accountDelegates:(t,r)=>Re(e,t,r),blendPools:t=>Ee(e,t),assets:t=>ie(e,t),hubs:t=>le(e,t),spokes:t=>se(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?pe(e,t,r):pe(e,{},t);var o},reserve:(t,r,o,n)=>de(e,t,r,o,n),reserveHolders:(t,r,o,n,u)=>ce(e,t,r,o,n,u),asset:(t,r)=>Se(e,t,r),assetMarkets:(t,r,o)=>be(e,t,r,o),hub:(t,r)=>ye(e,t,r),spoke:(t,r)=>me(e,t,r),userPositions:(t,r)=>fe(e,t,r),userActivity:(t,r,o)=>he(e,t,r,o),accountPositions:(t,r)=>Te(e,t,r),governanceProposals:(t,r)=>ve(e,t,r),assetGraph:(t,r,o)=>xe(e,t,r,o),hubGraph:(t,r,o)=>we(e,t,r,o),spokeGraph:(t,r,o)=>Ae(e,t,r,o),reserveGraph:(t,r,o,n,u)=>qe(e,t,r,o,n,u)}),Oe=e=>I({base_borrow_rate:m(e.baseBorrowRateRay),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:f(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Me=e=>I({asset_decimals:f(e.assetDecimals),asset_id:y(e.assetId),base_borrow_rate:m(e.baseBorrowRateRay),flashloan_fee:f(e.flashloanFeeBps),is_flashloanable:T(e.isFlashloanable),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:f(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Ce=e=>I({max_borrow_positions:f(e.maxBorrowPositions),max_supply_positions:f(e.maxSupplyPositions)}),Le=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)}`)},Be=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)}`)},Ue=e=>{if("Spot"===e)return A([x("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return A([x("Twap"),f(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Ge=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Ne=e=>{if("Market"===e||"Fundamental"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},$e=e=>{if("Reflector"in e){const t=e.Reflector;return A([x("Reflector"),I({asset:Be(t.asset),contract:y(t.contract),read_mode:Ue(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return A([x("MultiFeed"),I({contract:y(t.contract),feed_id:v(t.feedId),kind:Ge(t.kind),nature:Ne(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},De=e=>{const t=e;return I({decimals:f(t.decimals),max_stale_seconds:h(t.maxStaleSeconds),provider:$e(t.provider)})},We=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=>I({contract:y(e.contract),kind:Ge(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},ze=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 I({asset_decimals:f(Number(t.assetDecimals)),independence:We(t.independence),max_price_stale_seconds:h(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:m(String(t.maxSanityPriceWad)),min_sanity_price_wad:m(String(t.minSanityPriceWad)),sources:A(r.map((e=>(e=>{if("Feed"in e)return A([x("Feed"),De(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return A([x("Scaled"),I({factor:De(t.factor),max_factor_wad:m(t.maxFactorWad),min_factor_wad:m(t.minFactorWad),quote:Le(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return A([x("LpShare"),I({key_a:Le(t.keyA),key_b:Le(t.keyB),kind:A([x(t.kind||"ConstantProduct")]),pool:y(t.pool),reserve_a_decimals:f(t.reserveADecimals),reserve_b_decimals:f(t.reserveBDecimals),share_decimals:f(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:I({lower_ratio_bps:f(n),upper_ratio_bps:f(o)})})},He=ze;function Fe(e,t){return N(e,"upgrade",[q(t.wasmHash)])}function je(e,t){return N(e,"migrate",[f(t.newVersion)])}function Ve(e){return N(e,"pause",[])}function Xe(e){return N(e,"unpause",[])}function Qe(e,t){return N(e,"grant_role",[y(t.account),x(t.role)])}function Ze(e,t){return N(e,"revoke_role",[y(t.account),x(t.role)])}function Ke(e,t){return N(e,"transfer_ownership",[y(t.newOwner),f(t.liveUntilLedger)])}function Je(e){return N(e,"accept_ownership",[])}function Ye(e,t){return N(e,"set_swap_aggregator",[y(t.aggregator)])}function et(e,t){return N(e,"set_price_aggregator",[y(t.aggregator)])}const tt=Ye;function rt(e,t){return N(e,"set_accumulator",[y(t.accumulator)])}function ot(e,t){return N(e,"set_position_limits",[Ce(t)])}function nt(e,t){return N(e,"approve_blend_pool",[y(t.pool)])}function ut(e,t){return N(e,"revoke_blend_pool",[y(t.pool)])}const at=nt,it=ut;function lt(e,t){return N(e,"set_oracle",[Le(t.key),ze(t.oracle)])}const st=lt;function pt(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return N(e,"set_tolerance",[Le(t.key),I({lower_ratio_bps:f(n),upper_ratio_bps:f(o)})])}function dt(e,t){return N(e,"set_spoke_asset_flags",[f(t.spokeId),P(t.hubId,t.asset),T(t.paused),T(t.frozen),T(t.noSeize)])}function ct(e,t){return N(e,"set_oracle_sanity_bounds",[y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function St(e,t){return N(e,"update_indexes",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function gt(e,t){return N(e,"renew_account",[y(e.caller),h(t.accountNonce)])}function bt(e,t){return N(e,"create_liquidity_pool",[f(t.hubId),y(t.asset),Me(t.params)])}function yt(e,t){return N(e,"upgrade_liquidity_pool_params",[P(t.hubId,t.asset),Oe(t.params)])}function mt(e,t){return N(e,"claim_revenue",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function ft(e,t){return N(e,"add_rewards",[y(e.caller),R(t.rewards)])}function ht(e,t){return N(e,"update_account_threshold",[y(e.caller),T(t.hasRisks),A(t.accountNonces.map((e=>h(e))))])}const Tt="00".repeat(32),vt=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)},xt=(e,...t)=>A([x(e),...t]),wt=e=>I({new_owner:y(e.newOwner),live_until_ledger:f(e.liveUntilLedger)}),At=e=>I({asset:y(e.asset),bonus:f(e.bonus),borrow_cap:m(e.borrowCap),can_borrow:T(e.canBorrow),can_collateral:T(e.canCollateral),frozen:T(e.frozen),hub_id:f(e.hubId),paused:T(e.paused),liquidation_fees:f(e.liquidationFees),ltv:f(e.ltv),no_seize:T(e.noSeize),spoke_id:f(e.spokeId),supply_cap:m(e.supplyCap),threshold:f(e.threshold)}),qt=e=>I({account:y(e.account),role:x(e.role)});function _t(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 Pt=(e,t,r)=>_t(e,"propose",[y(e.caller),t,vt(r)]),kt=(e,t,r)=>_t(e,"execute_self",[w(),t,vt(r)]);function Rt(e,t,r){return Pt(e,xt("SetSwapAggregator",y(t.aggregator)),r)}function Et(e,t,r){return Pt(e,xt("SetPriceAggregator",y(t.aggregator)),r)}const It=Rt;function Ot(e,t,r){return Pt(e,xt("SetAccumulator",y(t.accumulator)),r)}function Mt(e,t,r){return Pt(e,xt("SetPositionLimits",Ce(t)),r)}function Ct(e,t){return Pt(e,xt("CreateHub"),t)}function Lt(e,t){return Pt(e,xt("AddSpoke"),t)}function Bt(e,t,r){return Pt(e,xt("RemoveSpoke",f(t.spokeId)),r)}function Ut(e,t,r){return Pt(e,xt("AddAssetToSpoke",At(t)),r)}function Gt(e,t,r){return Pt(e,xt("EditAssetInSpoke",At(t)),r)}function Nt(e,t,r){return Pt(e,xt("RemoveAssetFromSpoke",I({hub_asset:P((o=t).hubId,o.asset),spoke_id:f(o.spokeId)})),r);var o}function $t(e,t,r){return Pt(e,xt("SetSpokeLiquidationCurve",I({hf_for_max_bonus_wad:m((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:f(o.liquidationBonusFactorBps),spoke_id:f(o.spokeId),target_hf_wad:m(o.targetHfWad)})),r);var o}function Dt(e,t,r){return Pt(e,xt("SetPositionManager",y(t.manager),T(t.isActive)),r)}function Wt(e,t,r){return Pt(e,xt("SetMinBorrowCollateralUsd",m(t.floorWad)),r)}function zt(e,t,r){return Pt(e,xt("ApproveToken",y(t.token)),r)}function Ht(e,t,r){return Pt(e,xt("RevokeToken",y(t.token)),r)}function Ft(e,t,r){return Pt(e,xt("ApproveBlendPool",y(t.pool)),r)}function jt(e,t,r){return Pt(e,xt("RevokeBlendPool",y(t.pool)),r)}function Vt(e,t,r){return Pt(e,xt("CreateLiquidityPool",I({asset:y((o=t).asset),hub_id:f(o.hubId),params:Me(o.params)})),r);var o}function Xt(e,t,r){return Pt(e,xt("UpgradeLiquidityPoolParams",I({hub_asset:P((o=t).hubId,o.asset),params:Oe(o.params)})),r);var o}function Qt(e,t,r){return Pt(e,xt("DeployPool",q(t.wasmHash)),r)}function Zt(e,t,r){return Pt(e,xt("UpgradePool",q(t.wasmHash)),r)}function Kt(e,t,r){return Pt(e,xt("UpgradeController",q(t.wasmHash)),r)}function Jt(e,t,r){return Pt(e,xt("MigrateController",f(t.newVersion)),r)}function Yt(e,t,r){return Pt(e,xt("TransferCtrlOwnership",wt(t)),r)}function er(e,t,r){return Pt(e,xt("ConfigureAssetOracle",I({key:Le((o=t).key),oracle:ze(o.oracle)})),r);var o}const tr=er;function rr(e,t,r){return Pt(e,xt("EditOracleTolerance",I({key:Le((o=t).key),tolerance:f(o.tolerance)})),r);var o}function or(e,t,r){return Pt(e,xt("UpgradeGov",q(t.wasmHash)),r)}function nr(e,t,r){return Pt(e,xt("UpdateGovDelay",f(t.newDelay)),r)}function ur(e,t,r){return Pt(e,xt("GrantGovRole",qt(t)),r)}function ar(e,t,r){return Pt(e,xt("RevokeGovRole",qt(t)),r)}function ir(e,t,r){return Pt(e,xt("TransferGovOwnership",wt(t)),r)}function lr(e,t){const r=A(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),o=vt(t.predecessor??Tt);return _t(e,"execute",[w(),y(t.target),x(t.functionName),r,o,vt(t.salt)])}function sr(e,t,r){return kt(e,xt("UpgradeGov",q(t.wasmHash)),r)}function pr(e,t,r){return kt(e,xt("UpdateGovDelay",f(t.newDelay)),r)}function dr(e,t,r){return kt(e,xt("GrantGovRole",qt(t)),r)}function cr(e,t,r){return kt(e,xt("RevokeGovRole",qt(t)),r)}function Sr(e,t,r){return kt(e,xt("TransferGovOwnership",wt(t)),r)}const gr=e=>A(e.map(y));function br(e,t,r){return _t(e,"propose_canceller_reset",[gr(t.newCancellers),vt(r)])}function yr(e,t,r){return _t(e,"execute_canceller_reset",[_(t.executor,y),gr(t.newCancellers),vt(r)])}function mr(e,t){return _t(e,"set_spoke_asset_flags",[y(e.caller),f(t.spokeId),P(t.hubId,t.asset),T(t.paused),T(t.frozen),T(t.noSeize)])}function fr(e,t){return _t(e,"set_oracle_sanity_bounds",[y(e.caller),y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function hr(e){return _t(e,"create_hub",[y(e.caller)])}function Tr(e){return _t(e,"add_spoke",[y(e.caller)])}function vr(e,t){return _t(e,"revoke_role_immediate",[y(t.account),x(t.role)])}function xr(e){return _t(e,"pause",[y(e.caller)])}function wr(e,t){return Pt(e,xt("Unpause"),t)}const Ar=e=>e.toXDR("base64"),qr=e=>c.xdr.ScVal.fromXDR(e,"base64"),_r=e=>e.map((e=>String((0,c.scValToNative)(qr(e))))).join(":"),Pr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),kr=e=>Number(e),Rr=e=>String(e),Er=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Ir=["None","Multiply","Long","Short"],Or=["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","liq_credit"],Mr=e=>Array.isArray(e)?e:[],Cr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Or[kr(o)]??Pr(o)),positionType:t,hubId:kr(e[1]),asset:Rr(e[2]),scaledAmountRay:Pr(e[3]),indexRay:Pr(e[4]),amount:Pr(e[5]),liquidationThresholdBps:r?void 0:kr(e[6]),liquidationBonusBps:r?void 0:kr(e[7]),loanToValueBps:r?void 0:kr(e[8]),liquidationFeesBps:r?void 0:kr(e[9])};var o},Lr=e=>{return{owner:Rr(e[0]),spokeId:kr(e[1]),mode:(t=e[2],Ir[kr(t)]??"None")};var t},Br=e=>Array.isArray(e)?e[1]:void 0,Ur=e=>{const t=(r=e,Array.isArray(r)?Rr(r[0]):Rr(r));var r;if("Token"===t)return{Token:Rr(Br(e))};if("Ref"===t)return{Ref:Rr(Br(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Rr(t.Token)};if(void 0!==t.Ref)return{Ref:Rr(t.Ref)}}return{Token:Rr(e)}},Gr=e=>{const t=e.tolerance??{};return{assetDecimals:kr(e.asset_decimals),maxPriceStaleSeconds:kr(e.max_price_stale_seconds),sources:Mr(e.sources).map((e=>e)),tolerance:{upperRatio:kr(t.upper_ratio_bps),lowerRatio:kr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Pr(e.min_sanity_price_wad),maxSanityPriceWad:Pr(e.max_sanity_price_wad)}},Nr={"market:create":e=>({topic:"market:create",data:{hubId:kr(e.hub_id),baseAsset:Rr(e.base_asset),maxBorrowRate:Pr(e.max_borrow_rate),baseBorrowRate:Pr(e.base_borrow_rate),slope1:Pr(e.slope1),slope2:Pr(e.slope2),slope3:Pr(e.slope3),midUtilization:Pr(e.mid_utilization),optimalUtilization:Pr(e.optimal_utilization),maxUtilization:Pr(e.max_utilization),reserveFactor:kr(e.reserve_factor),marketAddress:Rr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Rr(e.asset),maxBorrowRateRay:Pr(e.max_borrow_rate),baseBorrowRateRay:Pr(e.base_borrow_rate),slope1Ray:Pr(e.slope1),slope2Ray:Pr(e.slope2),slope3Ray:Pr(e.slope3),midUtilizationRay:Pr(e.mid_utilization),optimalUtilizationRay:Pr(e.optimal_utilization),maxUtilizationRay:Pr(e.max_utilization),reserveFactorBps:kr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Mr(e).map((e=>{return t=Mr(e),{hubId:kr(t[0]),asset:Rr(t[1]),timestamp:kr(t[2]),supplyIndexRay:Pr(t[3]),borrowIndexRay:Pr(t[4]),cash:Pr(t[5]),suppliedRay:Pr(t[6]),borrowedRay:Pr(t[7]),revenueRay:Pr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Mr(e).map((e=>{const t=e;return{hubId:kr(t.hub_id),asset:Rr(t.asset),params:(r=t.params,{maxBorrowRateRay:Pr(r.max_borrow_rate),baseBorrowRateRay:Pr(r.base_borrow_rate),slope1Ray:Pr(r.slope1),slope2Ray:Pr(r.slope2),slope3Ray:Pr(r.slope3),midUtilizationRay:Pr(r.mid_utilization),optimalUtilizationRay:Pr(r.optimal_utilization),maxUtilizationRay:Pr(r.max_utilization),reserveFactorBps:kr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:kr(r.flashloan_fee),assetId:Rr(r.asset_id),assetDecimals:kr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Mr(e);return{topic:"position:batch_update",data:{accountId:Pr(t[0]),accountAttributes:Lr(Mr(t[1])),updates:[...Mr(t[2]).map((e=>Cr(Mr(e),"Deposit"))),...Mr(t[3]).map((e=>Cr(Mr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:kr(e.hub_id),asset:Rr(e.asset),receiver:Rr(e.receiver),caller:Rr(e.caller),amount:Pr(e.amount),fee:Pr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Ur(e.key),oracle:Gr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Rr(e.asset),oracle:Gr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Rr(e.liquidator),accountId:Pr(e.account_id),repaidUsdWad:Pr(e.repaid_usd_wad),bonusBps:Pr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Pr(e.account_id),totalBorrowUsdWad:Pr(e.total_borrow_usd_wad),totalCollateralUsdWad:Pr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Rr(e.token),amount:Pr(e.amount),usdValueWad:Pr(e.usd_value_wad),accountId:Pr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:kr(e.hub_id),asset:Rr(e.asset),amount:Pr(e.amount),fee:Pr(e.fee),amountSent:Pr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Rr(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:Er(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Rr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Rr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Rr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Rr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Er(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:kr(e.max_supply_positions),maxBorrowPositions:kr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Pr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Rr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:kr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Pr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Pr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:kr(t.liquidation_bonus_factor_bps)}}}},$r=Object.freeze(Object.keys(Nr));function Dr(e,t){const r=_r(e),o=Nr[r];return o?o((0,c.scValToNative)(qr(t))):null}const Wr=1e4;function zr(e,t){return`${e}-${BigInt(t).toString(10)}`}function Hr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Fr(e,t=0){return e*Wr+t}function jr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const Vr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Xr=e=>e.baseUrl??i[e.network];async function Qr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=Vr(Xr(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 Zr(e){const t=Vr(Xr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Kr=e=>M(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=U(((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 Yr(e,t){return Jr(e,t)}function eo(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(oo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(oo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function to(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:eo(e,t)}const ro=eo,oo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function no(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function uo(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw no(r.invokedContractId,e);throw e}}async function ao(e,t,r){return uo(e,t.xdr,r)}function io(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function lo(e,t){return new Uint8Array(0)}const so=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 po(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(so(e.message)),c.xdr.ScVal.scvBytes(so(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 co={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."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},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 So(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=co[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,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,decodeStellarLiquidateReturn:()=>m.decodeStellarLiquidateReturn,encodeAssetOracle:()=>m.encodeAssetOracle,encodeInterestRateModel:()=>m.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>m.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>m.encodeMarketParamsRaw,encodePositionLimits:()=>m.encodePositionLimits,encodePriceKey:()=>m.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>m.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>m.extractEventOrder,getStellarAccountDelegates:()=>m.getStellarAccountDelegates,getStellarAccountPositions:()=>m.getStellarAccountPositions,getStellarAggregatorQuote:()=>m.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>m.getStellarAggregatorRouter,getStellarAsset:()=>m.getStellarAsset,getStellarAssetGraph:()=>m.getStellarAssetGraph,getStellarAssetMarkets:()=>m.getStellarAssetMarkets,getStellarAssetPage:()=>m.getStellarAssetPage,getStellarAssets:()=>m.getStellarAssets,getStellarBlendPools:()=>m.getStellarBlendPools,getStellarContractConfig:()=>m.getStellarContractConfig,getStellarContractRoles:()=>m.getStellarContractRoles,getStellarGovernance:()=>m.getStellarGovernance,getStellarGovernanceProposals:()=>m.getStellarGovernanceProposals,getStellarHub:()=>m.getStellarHub,getStellarHubGraph:()=>m.getStellarHubGraph,getStellarHubs:()=>m.getStellarHubs,getStellarLendingContext:()=>m.getStellarLendingContext,getStellarLendingController:()=>m.getStellarLendingController,getStellarLendingLiveState:()=>m.getStellarLendingLiveState,getStellarProtocolConfig:()=>m.getStellarProtocolConfig,getStellarQuoteTokens:()=>m.getStellarQuoteTokens,getStellarReserve:()=>m.getStellarReserve,getStellarReserveGraph:()=>m.getStellarReserveGraph,getStellarReserveHolders:()=>m.getStellarReserveHolders,getStellarReserves:()=>m.getStellarReserves,getStellarSpoke:()=>m.getStellarSpoke,getStellarSpokeGraph:()=>m.getStellarSpokeGraph,getStellarSpokes:()=>m.getStellarSpokes,getStellarUserActivity:()=>m.getStellarUserActivity,getStellarUserPositions:()=>m.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>m.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>m.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>m.mapQuoteResponseToStrategySwap,mapSorobanError:()=>m.mapSorobanError,mapStellarPositionActivityType:()=>m.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>m.prepareStellarBuiltTx,prepareStellarTxXdr:()=>m.prepareStellarTxXdr,stellarLendingDispatchKey:()=>m.stellarLendingDispatchKey,stellarLendingRead:()=>m.stellarLendingRead,syntheticEventOrder:()=>m.syntheticEventOrder,tagStellarInvokedContractError:()=>m.tagStellarInvokedContractError,toBase64Xdr:()=>m.toBase64Xdr,toStellarPositionMode:()=>m.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...r}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=r,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=r,S=p?.Authorization,g="Bearer undefined"===S?void 0:S,b={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...g?{Authorization:g}:{}},y=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),m=`${this.apiUrl}${e}${y.length?`?${y}`:""}`,{revalidate:f,...h}=o??{},{revalidate:T,...v}=i??{},x="GET"!==d||g?void 0:T??f,w="GET"!==d||g||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:w,next:{...h,...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 g=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^[GC][A-Z2-7]{55}$/.test(e)),b={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},y=["PATCH","POST","DELETE","PUT"];var m=r(397);const f=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),h=()=>({static:{},params:{},leaves:[]});function T(e,t,r,o){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...r,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!g(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:y,method:m,headers:f,cache:h,next:T,debug:v,continuationToken:x,...w}=d,A=y?`Bearer ${y}`:void 0,q={...f,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},_={...T,tags:[...T?.tags??[],u]};return o.fetchWithTimeout(u,{method:m,params:w,body:b,headers:q,cache:h,debug:v,..._?{next:_}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))y.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=h();for(const[t,r]of Object.entries(b)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=f(e.slice(1));n=n.params[t]||=h()}else{const t=f(e);n=n.static[t]||=h()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:r,def:n}=t.leaves[0];i=T(r,n,o,e)}else{i={};for(const{rawPath:r,def:n}of t.leaves)i[f(r.split("/").pop().replace(/^:/,""))]=T(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),u=r)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=r(n,{...o,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],r=(...e)=>t(...e);return Object.assign(r,t)}return u};if(i[e]){const r=i[e];i[e]=e=>({...r(e),...t(e)})}else i[e]=t}return i};return r(t,{})}module.exports=o})();
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:()=>Tt,STELLAR_LENDING_CONTROLLER:()=>o,STELLAR_LENDING_TOPICS:()=>$r,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Wr,buildSameTokenRepaySwapSteps:()=>lo,buildStellarAcceptOwnershipTx:()=>Je,buildStellarAddRewardsTx:()=>ft,buildStellarApproveBlendPoolTx:()=>nt,buildStellarApproveTokenTx:()=>at,buildStellarBatchSwapTx:()=>Yr,buildStellarBorrowBatchTx:()=>W,buildStellarBorrowTx:()=>z,buildStellarCctpForwardTx:()=>po,buildStellarClaimRevenueTx:()=>mt,buildStellarCreateLiquidityPoolTx:()=>bt,buildStellarExecuteCancellerResetTx:()=>yr,buildStellarExecuteStrategyTx:()=>Jr,buildStellarFlashLoanTx:()=>Z,buildStellarGovernanceAddSpokeImmediateTx:()=>Tr,buildStellarGovernanceCreateHubImmediateTx:()=>hr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>sr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>dr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>cr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Sr,buildStellarGovernanceExecuteTx:()=>lr,buildStellarGovernanceExecuteUpdateDelayTx:()=>pr,buildStellarGovernancePauseTx:()=>xr,buildStellarGovernanceRevokeRoleImmediateTx:()=>vr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>fr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>mr,buildStellarGrantRoleTx:()=>Qe,buildStellarLendingIdentifier:()=>zr,buildStellarLiquidateTx:()=>X,buildStellarMigrateFromBlendTx:()=>K,buildStellarMigrateTx:()=>je,buildStellarMultiplyTx:()=>J,buildStellarPauseTx:()=>Ve,buildStellarProposeAddAssetToSpokeTx:()=>Ut,buildStellarProposeAddSpokeTx:()=>Lt,buildStellarProposeApproveBlendPoolTx:()=>Ft,buildStellarProposeApproveTokenTx:()=>zt,buildStellarProposeCancellerResetTx:()=>br,buildStellarProposeConfigureAssetOracleTx:()=>er,buildStellarProposeConfigureMarketOracleTx:()=>tr,buildStellarProposeCreateHubTx:()=>Ct,buildStellarProposeCreateLiquidityPoolTx:()=>Vt,buildStellarProposeDeployPoolTx:()=>Qt,buildStellarProposeEditAssetInSpokeTx:()=>Gt,buildStellarProposeEditOracleToleranceTx:()=>rr,buildStellarProposeGovernanceUpgradeTx:()=>or,buildStellarProposeGrantGovernanceRoleTx:()=>ur,buildStellarProposeMigrateControllerTx:()=>Jt,buildStellarProposeRemoveAssetFromSpokeTx:()=>Nt,buildStellarProposeRemoveSpokeTx:()=>Bt,buildStellarProposeRevokeBlendPoolTx:()=>jt,buildStellarProposeRevokeGovernanceRoleTx:()=>ar,buildStellarProposeRevokeTokenTx:()=>Ht,buildStellarProposeSetAccumulatorTx:()=>Ot,buildStellarProposeSetAggregatorTx:()=>It,buildStellarProposeSetMinBorrowCollatTx:()=>Wt,buildStellarProposeSetPositionLimitsTx:()=>Mt,buildStellarProposeSetPositionManagerTx:()=>Dt,buildStellarProposeSetPriceAggregatorTx:()=>Et,buildStellarProposeSetSpokeLiquidationCurveTx:()=>$t,buildStellarProposeSetSwapAggregatorTx:()=>Rt,buildStellarProposeTransferCtrlOwnershipTx:()=>Yt,buildStellarProposeTransferGovOwnTx:()=>ir,buildStellarProposeUnpauseTx:()=>wr,buildStellarProposeUpdateDelayTx:()=>nr,buildStellarProposeUpgradeControllerTx:()=>Kt,buildStellarProposeUpgradePoolParamsTx:()=>Xt,buildStellarProposeUpgradePoolTx:()=>Zt,buildStellarRenewAccountTx:()=>gt,buildStellarRepayBatchTx:()=>j,buildStellarRepayDebtWithCollateralTx:()=>te,buildStellarRepayTx:()=>V,buildStellarRevokeBlendPoolTx:()=>ut,buildStellarRevokeRoleTx:()=>Ze,buildStellarRevokeTokenTx:()=>it,buildStellarSetAccumulatorTx:()=>rt,buildStellarSetAggregatorTx:()=>tt,buildStellarSetMarketOracleConfigTx:()=>st,buildStellarSetOracleSanityBoundsTx:()=>ct,buildStellarSetOracleToleranceTx:()=>pt,buildStellarSetOracleTx:()=>lt,buildStellarSetPositionLimitsTx:()=>ot,buildStellarSetPriceAggregatorTx:()=>et,buildStellarSetSpokeAssetFlagsTx:()=>dt,buildStellarSetSwapAggregatorTx:()=>Ye,buildStellarSupplyBatchTx:()=>$,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>ee,buildStellarSwapDebtTx:()=>Y,buildStellarTransferOwnershipTx:()=>Ke,buildStellarUnpauseTx:()=>Xe,buildStellarUpdateAccountThresholdTx:()=>ht,buildStellarUpdateIndexesTx:()=>St,buildStellarUpgradeControllerTx:()=>Fe,buildStellarUpgradeLiquidityPoolParamsTx:()=>yt,buildStellarWithdrawBatchTx:()=>H,buildStellarWithdrawTx:()=>F,buildTx:()=>N,decodeStellarLendingEvent:()=>Dr,decodeStellarLiquidateReturn:()=>Q,encodeAssetOracle:()=>ze,encodeInterestRateModel:()=>Oe,encodeMarketOracleConfigInput:()=>He,encodeMarketParamsRaw:()=>Me,encodePositionLimits:()=>Ce,encodePriceKey:()=>Le,encodeStrategyPayloadToRouteXdr:()=>Kr,extractEventOrder:()=>Hr,getStellarAccountDelegates:()=>Re,getStellarAccountPositions:()=>Te,getStellarAggregatorQuote:()=>Qr,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>Se,getStellarAssetGraph:()=>xe,getStellarAssetMarkets:()=>be,getStellarAssetPage:()=>ge,getStellarAssets:()=>ie,getStellarBlendPools:()=>Ee,getStellarContractConfig:()=>Pe,getStellarContractRoles:()=>ke,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ve,getStellarHub:()=>ye,getStellarHubGraph:()=>we,getStellarHubs:()=>le,getStellarLendingContext:()=>ue,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>ae,getStellarProtocolConfig:()=>_e,getStellarQuoteTokens:()=>Zr,getStellarReserve:()=>de,getStellarReserveGraph:()=>qe,getStellarReserveHolders:()=>ce,getStellarReserves:()=>pe,getStellarSpoke:()=>me,getStellarSpokeGraph:()=>Ae,getStellarSpokes:()=>se,getStellarUserActivity:()=>he,getStellarUserPositions:()=>fe,mapQuoteResponseToAggregatorSwap:()=>ro,mapQuoteResponseToStrategyPayload:()=>eo,mapQuoteResponseToStrategySwap:()=>to,mapSorobanError:()=>So,mapStellarPositionActivityType:()=>jr,prepareStellarBuiltTx:()=>ao,prepareStellarTxXdr:()=>uo,stellarLendingDispatchKey:()=>_r,stellarLendingRead:()=>Ie,syntheticEventOrder:()=>Fr,tagStellarInvokedContractError:()=>no,toBase64Xdr:()=>Ar,toStellarPositionMode:()=>io});const o={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=o[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],g={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},b=1e6,y=e=>new c.Address(e).toScVal(),m=e=>new c.ScInt(e).toI128(),f=e=>c.xdr.ScVal.scvU32(e),h=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),T=e=>c.xdr.ScVal.scvBool(e),v=e=>c.xdr.ScVal.scvString(e),x=e=>c.xdr.ScVal.scvSymbol(e),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)=>I({asset:y(t),hub_id:f(e)}),k=(e,t,r)=>c.xdr.ScVal.scvVec([P(e,t),m(r)]),R=e=>c.xdr.ScVal.scvVec(e.map((e=>k(e.hubId,e.asset,e.amount)))),E=e=>{if("Transfer"===e)return A([x("Transfer")]);if(e&&"object"==typeof e&&"Credit"in e){const t=e.Credit;if("number"==typeof t&&!Number.isInteger(t))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${t}`);return A([x("Credit"),h(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},I=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 O{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>b)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(g[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const u=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(u>b)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const a=u===b;let i=b;n.forEach(((e,o)=>{r[e]=!0;const u=t[e];let l;if(o+1===n.length&&a)l=0;else{if(0===i)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(u.splitPpm*b/i);i-=Math.min(u.splitPpm,i),l=128+this.weight(e)}this.emitPath(u,l)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return Buffer.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const M=e=>{const t=new O(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=o,[a,i]=e.preSwapFromA?[n,u]:[u,n];t.emit(g.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(i))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return I({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))})},C=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)),B=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},U=e=>{if("string"==typeof e)return C(B(e));if(e instanceof Uint8Array)return 0===e.length?L():C(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?C(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?C(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?C(B(e.bytes)):0===e.bytes.length?L():C(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!S.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(M(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},G=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 N(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 $(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return N(e,"supply",[y(e.caller),h(r),f(o),R([...t.assets])])}function D(e,t){return $(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function W(e,t){return N(e,"borrow",[y(e.caller),h(t.accountNonce),R([...t.borrows]),_(t.to,y)])}function z(e,t){return W(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function H(e,t){return N(e,"withdraw",[y(e.caller),h(t.accountNonce),R([...t.withdrawals]),_(t.to,y)])}function F(e,t){return H(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function j(e,t){return N(e,"repay",[y(e.caller),h(t.accountNonce),R([...t.payments])])}function V(e,t){return j(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function X(e,t){return N(e,"liquidate",[y(e.caller),h(t.accountNonce),R([...t.debtPayments]),E(t.seizeMode??"Transfer")])}function Q(e){const t=(0,c.scValToNative)(c.xdr.ScVal.fromXDR(e,"base64"));if("bigint"==typeof t||"number"==typeof t)return t.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof t)}function Z(e,t){return N(e,"flash_loan",[y(e.caller),P(t.hubId,t.asset),m(t.amount),y(t.receiver),G(t.data)])}function K(e,t){return N(e,"migrate_from_blend",[y(e.caller),h(t.accountId),f(t.spokeId),f(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 J(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return N(e,"multiply",[y(e.caller),h(r),f(o),P(t.collateral.hubId,t.collateral.asset),m(t.debtToFlashLoan),P(t.debt.hubId,t.debt.asset),f(t.mode),U(t.steps),_(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),_(t.convertSwap,U)])}function Y(e,t){return N(e,"swap_debt",[y(e.caller),h(t.accountNonce),P(t.existingDebt.hubId,t.existingDebt.asset),m(t.newDebtAmount),P(t.newDebt.hubId,t.newDebt.asset),U(t.steps)])}function ee(e,t){return N(e,"swap_collateral",[y(e.caller),h(t.accountNonce),P(t.current.hubId,t.current.asset),m(t.fromAmount),P(t.newCollateral.hubId,t.newCollateral.asset),U(t.steps)])}function te(e,t){return N(e,"repay_debt_with_collateral",[y(e.caller),h(t.accountNonce),P(t.collateral.hubId,t.collateral.asset),m(t.collateralAmount),P(t.debt.hubId,t.debt.asset),U(t.steps),T(t.closePosition)])}const re="/stellar-lending",oe=25,ne=encodeURIComponent,ue=(e,t)=>e.fetchWithTimeout(`${re}/context`,t),ae=(e,t)=>e.fetchWithTimeout(`${re}/live-state`,t),ie=(e,t)=>e.fetchWithTimeout(`${re}/assets`,t),le=(e,t)=>e.fetchWithTimeout(`${re}/hubs`,t),se=(e,t)=>e.fetchWithTimeout(`${re}/spokes`,t),pe=(e,t={},r)=>{const{hubId:o,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${re}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},de=(e,t,r,o,n)=>e.fetchWithTimeout(`${re}/reserves/${t}/${r}/${ne(o)}`,n),ce=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${re}/reserves/${t}/${r}/${ne(o)}/holders`,{...u,params:{side:n}}),Se=(e,t,r)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}`,r),ge=(e,t,r,o)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}/page`,{...o,params:{...r}}),be=(e,t,r,o)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}/markets`,{...o,params:{side:r}}),ye=(e,t,r)=>e.fetchWithTimeout(`${re}/hubs/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${re}/spokes/${t}`,r),fe=(e,t,r)=>e.fetchWithTimeout(`${re}/users/${ne(t)}/positions`,r),he=(e,t,r={},o)=>{const{skip:n,top:u}=r;return e.fetchWithTimeout(`${re}/users/${ne(t)}/activity`,{...o,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},Te=(e,t,r)=>e.fetchWithTimeout(`${re}/accounts/${ne(t)}/positions`,r),ve=(e,t={},r)=>{const{top:o=oe,continuationToken:n}=t;return e.fetchWithTimeout(`${re}/governance/proposals`,{...r,params:{top:o,...n?{continuationToken:n}:{}}})},xe=(e,t,r,o)=>e.fetchWithTimeout(`${re}/assets/${ne(t)}/graph`,{...o,params:{...r}}),we=(e,t,r,o)=>e.fetchWithTimeout(`${re}/hubs/${t}/graph`,{...o,params:{...r}}),Ae=(e,t,r,o)=>e.fetchWithTimeout(`${re}/spokes/${t}/graph`,{...o,params:{...r}}),qe=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${re}/reserves/${t}/${r}/${ne(o)}/graph`,{...u,params:{...n}}),_e=(e,t)=>e.fetchWithTimeout(`${re}/protocol-config`,t),Pe=(e,t,r)=>e.fetchWithTimeout(`${re}/protocol-config/${ne(t)}`,r),ke=(e,t,r)=>e.fetchWithTimeout(t?`${re}/roles?contractAddress=${ne(t)}`:`${re}/roles`,r),Re=(e,t,r)=>e.fetchWithTimeout(`${re}/accounts/${ne(String(t))}/delegates`,r),Ee=(e,t)=>e.fetchWithTimeout(`${re}/blend-pools`,t),Ie=e=>({context:t=>ue(e,t),liveState:t=>ae(e,t),protocolConfig:t=>_e(e,t),contractConfig:(t,r)=>Pe(e,t,r),contractRoles:(t,r)=>ke(e,t,r),accountDelegates:(t,r)=>Re(e,t,r),blendPools:t=>Ee(e,t),assets:t=>ie(e,t),hubs:t=>le(e,t),spokes:t=>se(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?pe(e,t,r):pe(e,{},t);var o},reserve:(t,r,o,n)=>de(e,t,r,o,n),reserveHolders:(t,r,o,n,u)=>ce(e,t,r,o,n,u),asset:(t,r)=>Se(e,t,r),assetMarkets:(t,r,o)=>be(e,t,r,o),hub:(t,r)=>ye(e,t,r),spoke:(t,r)=>me(e,t,r),userPositions:(t,r)=>fe(e,t,r),userActivity:(t,r,o)=>he(e,t,r,o),accountPositions:(t,r)=>Te(e,t,r),governanceProposals:(t,r)=>ve(e,t,r),assetGraph:(t,r,o)=>xe(e,t,r,o),hubGraph:(t,r,o)=>we(e,t,r,o),spokeGraph:(t,r,o)=>Ae(e,t,r,o),reserveGraph:(t,r,o,n,u)=>qe(e,t,r,o,n,u)}),Oe=e=>I({base_borrow_rate:m(e.baseBorrowRateRay),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:f(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Me=e=>I({asset_decimals:f(e.assetDecimals),asset_id:y(e.assetId),base_borrow_rate:m(e.baseBorrowRateRay),flashloan_fee:f(e.flashloanFeeBps),is_flashloanable:T(e.isFlashloanable),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:f(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Ce=e=>I({max_borrow_positions:f(e.maxBorrowPositions),max_supply_positions:f(e.maxSupplyPositions)}),Le=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)}`)},Be=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)}`)},Ue=e=>{if("Spot"===e)return A([x("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return A([x("Twap"),f(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Ge=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Ne=e=>{if("Market"===e||"Fundamental"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},$e=e=>{if("Reflector"in e){const t=e.Reflector;return A([x("Reflector"),I({asset:Be(t.asset),contract:y(t.contract),read_mode:Ue(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return A([x("MultiFeed"),I({contract:y(t.contract),feed_id:v(t.feedId),kind:Ge(t.kind),nature:Ne(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},De=e=>{const t=e;return I({decimals:f(t.decimals),max_stale_seconds:h(t.maxStaleSeconds),provider:$e(t.provider)})},We=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=>I({contract:y(e.contract),kind:Ge(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},ze=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 I({asset_decimals:f(Number(t.assetDecimals)),independence:We(t.independence),max_price_stale_seconds:h(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:m(String(t.maxSanityPriceWad)),min_sanity_price_wad:m(String(t.minSanityPriceWad)),sources:A(r.map((e=>(e=>{if("Feed"in e)return A([x("Feed"),De(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return A([x("Scaled"),I({factor:De(t.factor),max_factor_wad:m(t.maxFactorWad),min_factor_wad:m(t.minFactorWad),quote:Le(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return A([x("LpShare"),I({key_a:Le(t.keyA),key_b:Le(t.keyB),kind:A([x(t.kind||"ConstantProduct")]),pool:y(t.pool),reserve_a_decimals:f(t.reserveADecimals),reserve_b_decimals:f(t.reserveBDecimals),share_decimals:f(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:I({lower_ratio_bps:f(n),upper_ratio_bps:f(o)})})},He=ze;function Fe(e,t){return N(e,"upgrade",[q(t.wasmHash)])}function je(e,t){return N(e,"migrate",[f(t.newVersion)])}function Ve(e){return N(e,"pause",[])}function Xe(e){return N(e,"unpause",[])}function Qe(e,t){return N(e,"grant_role",[y(t.account),x(t.role)])}function Ze(e,t){return N(e,"revoke_role",[y(t.account),x(t.role)])}function Ke(e,t){return N(e,"transfer_ownership",[y(t.newOwner),f(t.liveUntilLedger)])}function Je(e){return N(e,"accept_ownership",[])}function Ye(e,t){return N(e,"set_swap_aggregator",[y(t.aggregator)])}function et(e,t){return N(e,"set_price_aggregator",[y(t.aggregator)])}const tt=Ye;function rt(e,t){return N(e,"set_accumulator",[y(t.accumulator)])}function ot(e,t){return N(e,"set_position_limits",[Ce(t)])}function nt(e,t){return N(e,"approve_blend_pool",[y(t.pool)])}function ut(e,t){return N(e,"revoke_blend_pool",[y(t.pool)])}const at=nt,it=ut;function lt(e,t){return N(e,"set_oracle",[Le(t.key),ze(t.oracle)])}const st=lt;function pt(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return N(e,"set_tolerance",[Le(t.key),I({lower_ratio_bps:f(n),upper_ratio_bps:f(o)})])}function dt(e,t){return N(e,"set_spoke_asset_flags",[f(t.spokeId),P(t.hubId,t.asset),T(t.paused),T(t.frozen),T(t.noSeize)])}function ct(e,t){return N(e,"set_oracle_sanity_bounds",[y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function St(e,t){return N(e,"update_indexes",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function gt(e,t){return N(e,"renew_account",[y(e.caller),h(t.accountNonce)])}function bt(e,t){return N(e,"create_liquidity_pool",[f(t.hubId),y(t.asset),Me(t.params)])}function yt(e,t){return N(e,"upgrade_liquidity_pool_params",[P(t.hubId,t.asset),Oe(t.params)])}function mt(e,t){return N(e,"claim_revenue",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function ft(e,t){return N(e,"add_rewards",[y(e.caller),R(t.rewards)])}function ht(e,t){return N(e,"update_account_threshold",[y(e.caller),T(t.hasRisks),A(t.accountNonces.map((e=>h(e))))])}const Tt="00".repeat(32),vt=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)},xt=(e,...t)=>A([x(e),...t]),wt=e=>I({new_owner:y(e.newOwner),live_until_ledger:f(e.liveUntilLedger)}),At=e=>I({asset:y(e.asset),bonus:f(e.bonus),borrow_cap:m(e.borrowCap),can_borrow:T(e.canBorrow),can_collateral:T(e.canCollateral),frozen:T(e.frozen),hub_id:f(e.hubId),paused:T(e.paused),liquidation_fees:f(e.liquidationFees),ltv:f(e.ltv),no_seize:T(e.noSeize),spoke_id:f(e.spokeId),supply_cap:m(e.supplyCap),threshold:f(e.threshold)}),qt=e=>I({account:y(e.account),role:x(e.role)});function _t(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 Pt=(e,t,r)=>_t(e,"propose",[y(e.caller),t,vt(r)]),kt=(e,t,r)=>_t(e,"execute_self",[w(),t,vt(r)]);function Rt(e,t,r){return Pt(e,xt("SetSwapAggregator",y(t.aggregator)),r)}function Et(e,t,r){return Pt(e,xt("SetPriceAggregator",y(t.aggregator)),r)}const It=Rt;function Ot(e,t,r){return Pt(e,xt("SetAccumulator",y(t.accumulator)),r)}function Mt(e,t,r){return Pt(e,xt("SetPositionLimits",Ce(t)),r)}function Ct(e,t){return Pt(e,xt("CreateHub"),t)}function Lt(e,t){return Pt(e,xt("AddSpoke"),t)}function Bt(e,t,r){return Pt(e,xt("RemoveSpoke",f(t.spokeId)),r)}function Ut(e,t,r){return Pt(e,xt("AddAssetToSpoke",At(t)),r)}function Gt(e,t,r){return Pt(e,xt("EditAssetInSpoke",At(t)),r)}function Nt(e,t,r){return Pt(e,xt("RemoveAssetFromSpoke",I({hub_asset:P((o=t).hubId,o.asset),spoke_id:f(o.spokeId)})),r);var o}function $t(e,t,r){return Pt(e,xt("SetSpokeLiquidationCurve",I({hf_for_max_bonus_wad:m((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:f(o.liquidationBonusFactorBps),spoke_id:f(o.spokeId),target_hf_wad:m(o.targetHfWad)})),r);var o}function Dt(e,t,r){return Pt(e,xt("SetPositionManager",y(t.manager),T(t.isActive)),r)}function Wt(e,t,r){return Pt(e,xt("SetMinBorrowCollateralUsd",m(t.floorWad)),r)}function zt(e,t,r){return Pt(e,xt("ApproveToken",y(t.token)),r)}function Ht(e,t,r){return Pt(e,xt("RevokeToken",y(t.token)),r)}function Ft(e,t,r){return Pt(e,xt("ApproveBlendPool",y(t.pool)),r)}function jt(e,t,r){return Pt(e,xt("RevokeBlendPool",y(t.pool)),r)}function Vt(e,t,r){return Pt(e,xt("CreateLiquidityPool",I({asset:y((o=t).asset),hub_id:f(o.hubId),params:Me(o.params)})),r);var o}function Xt(e,t,r){return Pt(e,xt("UpgradeLiquidityPoolParams",I({hub_asset:P((o=t).hubId,o.asset),params:Oe(o.params)})),r);var o}function Qt(e,t,r){return Pt(e,xt("DeployPool",q(t.wasmHash)),r)}function Zt(e,t,r){return Pt(e,xt("UpgradePool",q(t.wasmHash)),r)}function Kt(e,t,r){return Pt(e,xt("UpgradeController",q(t.wasmHash)),r)}function Jt(e,t,r){return Pt(e,xt("MigrateController",f(t.newVersion)),r)}function Yt(e,t,r){return Pt(e,xt("TransferCtrlOwnership",wt(t)),r)}function er(e,t,r){return Pt(e,xt("ConfigureAssetOracle",I({key:Le((o=t).key),oracle:ze(o.oracle)})),r);var o}const tr=er;function rr(e,t,r){return Pt(e,xt("EditOracleTolerance",I({key:Le((o=t).key),tolerance:f(o.tolerance)})),r);var o}function or(e,t,r){return Pt(e,xt("UpgradeGov",q(t.wasmHash)),r)}function nr(e,t,r){return Pt(e,xt("UpdateGovDelay",f(t.newDelay)),r)}function ur(e,t,r){return Pt(e,xt("GrantGovRole",qt(t)),r)}function ar(e,t,r){return Pt(e,xt("RevokeGovRole",qt(t)),r)}function ir(e,t,r){return Pt(e,xt("TransferGovOwnership",wt(t)),r)}function lr(e,t){const r=A(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),o=vt(t.predecessor??Tt);return _t(e,"execute",[w(),y(t.target),x(t.functionName),r,o,vt(t.salt)])}function sr(e,t,r){return kt(e,xt("UpgradeGov",q(t.wasmHash)),r)}function pr(e,t,r){return kt(e,xt("UpdateGovDelay",f(t.newDelay)),r)}function dr(e,t,r){return kt(e,xt("GrantGovRole",qt(t)),r)}function cr(e,t,r){return kt(e,xt("RevokeGovRole",qt(t)),r)}function Sr(e,t,r){return kt(e,xt("TransferGovOwnership",wt(t)),r)}const gr=e=>A(e.map(y));function br(e,t,r){return _t(e,"propose_canceller_reset",[gr(t.newCancellers),vt(r)])}function yr(e,t,r){return _t(e,"execute_canceller_reset",[_(t.executor,y),gr(t.newCancellers),vt(r)])}function mr(e,t){return _t(e,"set_spoke_asset_flags",[y(e.caller),f(t.spokeId),P(t.hubId,t.asset),T(t.paused),T(t.frozen),T(t.noSeize)])}function fr(e,t){return _t(e,"set_oracle_sanity_bounds",[y(e.caller),y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function hr(e){return _t(e,"create_hub",[y(e.caller)])}function Tr(e){return _t(e,"add_spoke",[y(e.caller)])}function vr(e,t){return _t(e,"revoke_role_immediate",[y(t.account),x(t.role)])}function xr(e){return _t(e,"pause",[y(e.caller)])}function wr(e,t){return Pt(e,xt("Unpause"),t)}const Ar=e=>e.toXDR("base64"),qr=e=>c.xdr.ScVal.fromXDR(e,"base64"),_r=e=>e.map((e=>String((0,c.scValToNative)(qr(e))))).join(":"),Pr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),kr=e=>Number(e),Rr=e=>String(e),Er=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Ir=["None","Multiply","Long","Short"],Or=["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","liq_credit"],Mr=e=>Array.isArray(e)?e:[],Cr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Or[kr(o)]??Pr(o)),positionType:t,hubId:kr(e[1]),asset:Rr(e[2]),scaledAmountRay:Pr(e[3]),indexRay:Pr(e[4]),amount:Pr(e[5]),liquidationThresholdBps:r?void 0:kr(e[6]),liquidationBonusBps:r?void 0:kr(e[7]),loanToValueBps:r?void 0:kr(e[8]),liquidationFeesBps:r?void 0:kr(e[9])};var o},Lr=e=>{return{owner:Rr(e[0]),spokeId:kr(e[1]),mode:(t=e[2],Ir[kr(t)]??"None")};var t},Br=e=>Array.isArray(e)?e[1]:void 0,Ur=e=>{const t=(r=e,Array.isArray(r)?Rr(r[0]):Rr(r));var r;if("Token"===t)return{Token:Rr(Br(e))};if("Ref"===t)return{Ref:Rr(Br(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Rr(t.Token)};if(void 0!==t.Ref)return{Ref:Rr(t.Ref)}}return{Token:Rr(e)}},Gr=e=>{const t=e.tolerance??{};return{assetDecimals:kr(e.asset_decimals),maxPriceStaleSeconds:kr(e.max_price_stale_seconds),sources:Mr(e.sources).map((e=>e)),tolerance:{upperRatio:kr(t.upper_ratio_bps),lowerRatio:kr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Pr(e.min_sanity_price_wad),maxSanityPriceWad:Pr(e.max_sanity_price_wad)}},Nr={"market:create":e=>({topic:"market:create",data:{hubId:kr(e.hub_id),baseAsset:Rr(e.base_asset),maxBorrowRate:Pr(e.max_borrow_rate),baseBorrowRate:Pr(e.base_borrow_rate),slope1:Pr(e.slope1),slope2:Pr(e.slope2),slope3:Pr(e.slope3),midUtilization:Pr(e.mid_utilization),optimalUtilization:Pr(e.optimal_utilization),maxUtilization:Pr(e.max_utilization),reserveFactor:kr(e.reserve_factor),marketAddress:Rr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Rr(e.asset),maxBorrowRateRay:Pr(e.max_borrow_rate),baseBorrowRateRay:Pr(e.base_borrow_rate),slope1Ray:Pr(e.slope1),slope2Ray:Pr(e.slope2),slope3Ray:Pr(e.slope3),midUtilizationRay:Pr(e.mid_utilization),optimalUtilizationRay:Pr(e.optimal_utilization),maxUtilizationRay:Pr(e.max_utilization),reserveFactorBps:kr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Mr(e).map((e=>{return t=Mr(e),{hubId:kr(t[0]),asset:Rr(t[1]),timestamp:kr(t[2]),supplyIndexRay:Pr(t[3]),borrowIndexRay:Pr(t[4]),cash:Pr(t[5]),suppliedRay:Pr(t[6]),borrowedRay:Pr(t[7]),revenueRay:Pr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Mr(e).map((e=>{const t=e;return{hubId:kr(t.hub_id),asset:Rr(t.asset),params:(r=t.params,{maxBorrowRateRay:Pr(r.max_borrow_rate),baseBorrowRateRay:Pr(r.base_borrow_rate),slope1Ray:Pr(r.slope1),slope2Ray:Pr(r.slope2),slope3Ray:Pr(r.slope3),midUtilizationRay:Pr(r.mid_utilization),optimalUtilizationRay:Pr(r.optimal_utilization),maxUtilizationRay:Pr(r.max_utilization),reserveFactorBps:kr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:kr(r.flashloan_fee),assetId:Rr(r.asset_id),assetDecimals:kr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Mr(e);return{topic:"position:batch_update",data:{accountId:Pr(t[0]),accountAttributes:Lr(Mr(t[1])),updates:[...Mr(t[2]).map((e=>Cr(Mr(e),"Deposit"))),...Mr(t[3]).map((e=>Cr(Mr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:kr(e.hub_id),asset:Rr(e.asset),receiver:Rr(e.receiver),caller:Rr(e.caller),amount:Pr(e.amount),fee:Pr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Ur(e.key),oracle:Gr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Rr(e.asset),oracle:Gr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Rr(e.liquidator),accountId:Pr(e.account_id),repaidUsdWad:Pr(e.repaid_usd_wad),bonusBps:Pr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Pr(e.account_id),totalBorrowUsdWad:Pr(e.total_borrow_usd_wad),totalCollateralUsdWad:Pr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Rr(e.token),amount:Pr(e.amount),usdValueWad:Pr(e.usd_value_wad),accountId:Pr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:kr(e.hub_id),asset:Rr(e.asset),amount:Pr(e.amount),fee:Pr(e.fee),amountSent:Pr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Rr(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:Er(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Rr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Rr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Rr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Rr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Er(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:kr(e.max_supply_positions),maxBorrowPositions:kr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Pr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Rr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:kr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Pr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Pr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:kr(t.liquidation_bonus_factor_bps)}}}},$r=Object.freeze(Object.keys(Nr));function Dr(e,t){const r=_r(e),o=Nr[r];return o?o((0,c.scValToNative)(qr(t))):null}const Wr=1e4;function zr(e,t){return`${e}-${BigInt(t).toString(10)}`}function Hr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Fr(e,t=0){return e*Wr+t}function jr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const Vr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Xr=e=>e.baseUrl??i[e.network];async function Qr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=Vr(Xr(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 Zr(e){const t=Vr(Xr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Kr=e=>M(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=U(((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 Yr(e,t){return Jr(e,t)}function eo(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(oo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(oo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function to(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:eo(e,t)}const ro=eo,oo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function no(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function uo(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw no(r.invokedContractId,e);throw e}}async function ao(e,t,r){return uo(e,t.xdr,r)}function io(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function lo(e,t){return new Uint8Array(0)}const so=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 po(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(so(e.message)),c.xdr.ScVal.scvBytes(so(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 co={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."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},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 So(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=co[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,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,decodeStellarLiquidateReturn:()=>m.decodeStellarLiquidateReturn,encodeAssetOracle:()=>m.encodeAssetOracle,encodeInterestRateModel:()=>m.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>m.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>m.encodeMarketParamsRaw,encodePositionLimits:()=>m.encodePositionLimits,encodePriceKey:()=>m.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>m.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>m.extractEventOrder,getStellarAccountDelegates:()=>m.getStellarAccountDelegates,getStellarAccountPositions:()=>m.getStellarAccountPositions,getStellarAggregatorQuote:()=>m.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>m.getStellarAggregatorRouter,getStellarAsset:()=>m.getStellarAsset,getStellarAssetGraph:()=>m.getStellarAssetGraph,getStellarAssetMarkets:()=>m.getStellarAssetMarkets,getStellarAssetPage:()=>m.getStellarAssetPage,getStellarAssets:()=>m.getStellarAssets,getStellarBlendPools:()=>m.getStellarBlendPools,getStellarContractConfig:()=>m.getStellarContractConfig,getStellarContractRoles:()=>m.getStellarContractRoles,getStellarGovernance:()=>m.getStellarGovernance,getStellarGovernanceProposals:()=>m.getStellarGovernanceProposals,getStellarHub:()=>m.getStellarHub,getStellarHubGraph:()=>m.getStellarHubGraph,getStellarHubs:()=>m.getStellarHubs,getStellarLendingContext:()=>m.getStellarLendingContext,getStellarLendingController:()=>m.getStellarLendingController,getStellarLendingLiveState:()=>m.getStellarLendingLiveState,getStellarProtocolConfig:()=>m.getStellarProtocolConfig,getStellarQuoteTokens:()=>m.getStellarQuoteTokens,getStellarReserve:()=>m.getStellarReserve,getStellarReserveGraph:()=>m.getStellarReserveGraph,getStellarReserveHolders:()=>m.getStellarReserveHolders,getStellarReserves:()=>m.getStellarReserves,getStellarSpoke:()=>m.getStellarSpoke,getStellarSpokeGraph:()=>m.getStellarSpokeGraph,getStellarSpokes:()=>m.getStellarSpokes,getStellarUserActivity:()=>m.getStellarUserActivity,getStellarUserPositions:()=>m.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>m.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>m.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>m.mapQuoteResponseToStrategySwap,mapSorobanError:()=>m.mapSorobanError,mapStellarPositionActivityType:()=>m.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>m.prepareStellarBuiltTx,prepareStellarTxXdr:()=>m.prepareStellarTxXdr,stellarLendingDispatchKey:()=>m.stellarLendingDispatchKey,stellarLendingRead:()=>m.stellarLendingRead,syntheticEventOrder:()=>m.syntheticEventOrder,tagStellarInvokedContractError:()=>m.tagStellarInvokedContractError,toBase64Xdr:()=>m.toBase64Xdr,toStellarPositionMode:()=>m.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...r}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=r,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=r,S=p?.Authorization,g="Bearer undefined"===S?void 0:S,b={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...g?{Authorization:g}:{}},y=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),m=`${this.apiUrl}${e}${y.length?`?${y}`:""}`,{revalidate:f,...h}=o??{},{revalidate:T,...v}=i??{},x="GET"!==d||g?void 0:T??f,w="GET"!==d||g||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:w,next:{...h,...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),o=/^C[A-Z2-7]{55}$/.test(e);return t||r||o},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),o=/^C[A-Z2-7]{55}-\d+$/.test(e);return t||r||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const g=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^[GC][A-Z2-7]{55}$/.test(e)),b={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},y=["PATCH","POST","DELETE","PUT"];var m=r(397);const f=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),h=()=>({static:{},params:{},leaves:[]});function T(e,t,r,o){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...r,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!g(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:y,method:m,headers:f,cache:h,next:T,debug:v,continuationToken:x,...w}=d,A=y?`Bearer ${y}`:void 0,q={...f,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},_={...T,tags:[...T?.tags??[],u]};return o.fetchWithTimeout(u,{method:m,params:w,body:b,headers:q,cache:h,debug:v,..._?{next:_}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))y.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=h();for(const[t,r]of Object.entries(b)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=f(e.slice(1));n=n.params[t]||=h()}else{const t=f(e);n=n.static[t]||=h()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:r,def:n}=t.leaves[0];i=T(r,n,o,e)}else{i={};for(const{rawPath:r,def:n}of t.leaves)i[f(r.split("/").pop().replace(/^:/,""))]=T(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),u=r)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=r(n,{...o,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],r=(...e)=>t(...e);return Object.assign(r,t)}return u};if(i[e]){const r=i[e];i[e]=e=>({...r(e),...t(e)})}else i[e]=t}return i};return r(t,{})}module.exports=o})();
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as i,xdr as s}from"@stellar/stellar-sdk";var a={385(a,p,l){l.d(p,{ME:()=>d,nO:()=>y,G_:()=>ke,DU:()=>c,fA:()=>Xo,A$:()=>m,J9:()=>f,hS:()=>g,gR:()=>Zo,VZ:()=>mr,N0:()=>ue,B_:()=>_e,qL:()=>ce,eX:()=>ye,z:()=>sr,xD:()=>K,jR:()=>Z,P2:()=>br,W6:()=>Te,se:()=>we,ZP:()=>To,yr:()=>ir,sp:()=>rt,Iu:()=>Po,yu:()=>ko,$9:()=>ho,zw:()=>So,h_:()=>xo,e_:()=>vo,Tk:()=>mo,BA:()=>bo,u9:()=>Eo,bi:()=>Io,gc:()=>Ao,ay:()=>_o,SX:()=>oe,UF:()=>Qo,Y5:()=>et,mE:()=>nt,xG:()=>Yt,s9:()=>ut,OL:()=>te,k6:()=>Ve,dj:()=>ze,kD:()=>Je,Yf:()=>Ze,AI:()=>qo,O2:()=>so,c5:()=>ao,N8:()=>Ge,qU:()=>to,RZ:()=>oo,ni:()=>je,hF:()=>po,Qk:()=>lo,Gw:()=>yo,$K:()=>uo,uj:()=>Fe,Od:()=>We,X7:()=>Ye,Ub:()=>go,Dx:()=>Qe,OA:()=>Be,$U:()=>Ne,ob:()=>Ke,$l:()=>De,K:()=>Xe,Wb:()=>Ce,kw:()=>He,qA:()=>$e,VS:()=>io,HP:()=>fo,xQ:()=>Ro,YQ:()=>co,QY:()=>no,os:()=>eo,Ko:()=>ro,IJ:()=>ve,nw:()=>Y,Pr:()=>at,ZE:()=>tt,X0:()=>de,ev:()=>re,P8:()=>ge,aV:()=>pe,p2:()=>ae,sV:()=>me,XD:()=>Se,Js:()=>he,W5:()=>fe,Dy:()=>le,_i:()=>se,FZ:()=>be,wG:()=>ie,Ni:()=>H,v_:()=>X,qD:()=>st,qR:()=>it,QJ:()=>ne,bm:()=>ee,n_:()=>Ae,v8:()=>xe,qM:()=>Jt,gH:()=>qe,O3:()=>Q,Gz:()=>J,pr:()=>F,Fm:()=>Ko,OB:()=>ot,Ft:()=>Zt,MB:()=>Bt,Dn:()=>Qt,pq:()=>Dt,Q3:()=>Gt,Jh:()=>zt,wf:()=>ur,Um:()=>Jo,XR:()=>$t,xO:()=>kt,Lw:()=>rr,KM:()=>b,mM:()=>xt,iE:()=>It,zp:()=>wt,N3:()=>vt,bN:()=>gt,cK:()=>Ct,kV:()=>Lt,vo:()=>Ut,QV:()=>S,T_:()=>Pt,XI:()=>qt,Lt:()=>Et,KK:()=>ft,yl:()=>dt,vc:()=>h,kq:()=>yt,Mi:()=>Ot,CH:()=>nr,FI:()=>bt,KG:()=>Mt,nW:()=>St,jF:()=>ht,S2:()=>Tt,uS:()=>Rt,u_:()=>mt,O5:()=>At,Av:()=>_t,LA:()=>lr,E6:()=>ar,Ds:()=>pr,XV:()=>xr,CU:()=>tr,Vx:()=>gr,DL:()=>yr,ON:()=>Lo,Hh:()=>Nt,oV:()=>Yo,g5:()=>dr,L:()=>Mo,Vu:()=>fr});const c={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},d={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},y={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},g={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},f={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},m={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function h(t){const e=c[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function b(t){const e=d[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function S(t){const e=y[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const x=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],v={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},w=1e6,q=t=>new e(t).toScVal(),T=t=>new n(t).toI128(),_=t=>s.ScVal.scvU32(t),A=t=>new n("string"==typeof t?t:t.toString()).toU64(),k=t=>s.ScVal.scvBool(t),P=t=>s.ScVal.scvString(t),I=t=>s.ScVal.scvSymbol(t),E=()=>s.ScVal.scvVoid(),R=t=>s.ScVal.scvVec(t),M=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return s.ScVal.scvBytes(r)},O=(t,e)=>null==t?E():e(t),L=(t,e)=>N({asset:q(e),hub_id:_(t)}),U=(t,e,o)=>s.ScVal.scvVec([L(t,e),T(o)]),$=t=>s.ScVal.scvVec(t.map((t=>U(t.hubId,t.asset,t.amount)))),C=t=>{if("Transfer"===t)return R([I("Transfer")]);if(t&&"object"==typeof t&&"Credit"in t){const e=t.Credit;if("number"==typeof e&&!Number.isInteger(e))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${e}`);return R([I("Credit"),A(e)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(t)}`)},N=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:I(e),val:t[e]})));return s.ScVal.scvMap(e)};class B{assets=[];amounts=[];ops=[];weights=[];constructor(t){this.amounts.push(t)}asset(t){const e=this.assets.indexOf(t);if(-1!==e)return e;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(t),this.assets.length-1}amount(t){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(t),this.amounts.length-1}weight(t){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(t)||t<=0||t>w)throw new Error(`Stellar builder: split weight ${t} outside 1..=1000000`);return this.weights.push(t),this.weights.length-1}emit(t,e,o,r,n){this.ops.push([t,e,o,r,n])}emitPath(t,e){t.hops.forEach(((o,r)=>{if(o.tokenIn===o.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=t.hops[r-1];if(n&&o.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(v[o.venue],0===r?e:1,this.asset(o.pool),this.asset(o.tokenIn),this.asset(o.tokenOut))}))}lowerPaths(t){const e=t.filter((t=>t.hops.length>0)),o=Array.from({length:e.length},(()=>!1));for(let t=0;t<e.length;t+=1){if(o[t])continue;const r=e[t].hops[0]?.tokenIn,n=[];for(let o=t;o<e.length;o+=1)e[o].hops[0]?.tokenIn===r&&n.push(o);const u=n.reduce(((t,o)=>t+e[o].splitPpm),0);if(u>w)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const i=u===w;let s=w;n.forEach(((t,r)=>{o[t]=!0;const u=e[t];let a;if(r+1===n.length&&i)a=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const t=Math.floor(u.splitPpm*w/s);s-=Math.min(u.splitPpm,s),a=128+this.weight(t)}this.emitPath(u,a)}))}}toBytes(t,e,o){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 r=[1,t,e,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,this.ops.length,this.weights.length];for(const t of this.ops)r.push(...t);for(const t of this.weights)r.push(t>>>16&255,t>>>8&255,255&t);return Buffer.from(r)}get assetList(){return this.assets}get amountList(){return this.amounts}}const D=t=>{const e=new B(t.totalMinOut),o=e.asset(t.tokenIn),r=e.asset(t.tokenOut);if(o===r)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(t.burnPool){const r=e.asset(t.burnPool),n=e.amountList.length;for(const o of t.burnMinAmounts??[])e.amount(o);e.emit(5,0,r,o,n)}if(e.lowerPaths(t.paths),t.mintPool){const o=t.preSwapAmount;if(o&&BigInt(o)>0n){const r=t.mintPoolTokens;if(!r||2!==r.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=r,[i,s]=t.preSwapFromA?[n,u]:[u,n];e.emit(v.Aquarius,2+e.amount(o),e.asset(t.mintPool),e.asset(i),e.asset(s))}e.emit(6,0,e.asset(t.mintPool),r,e.amount(t.mintMinShares??"1"))}const n=Number(t.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${t.referralId} does not fit the wire’s u32`);return N({amounts:s.ScVal.scvVec(e.amountList.map((t=>T(t)))),assets:s.ScVal.scvVec(e.assetList.map((t=>q(t)))),ops:s.ScVal.scvBytes(e.toBytes(o,r,n))})},G=t=>{const e=Buffer.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},z=()=>s.ScVal.scvBytes(Buffer.alloc(0)),W=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},V=t=>{if("string"==typeof t)return G(W(t));if(t instanceof Uint8Array)return 0===t.length?z():G(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?G(W(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?G(W(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?G(W(t.bytes)):0===t.bytes.length?z():G(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const o=new Map;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!x.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const e=r.hops[0];o.set(e.tokenIn,(o.get(e.tokenIn)??0)+r.splitPpm)}for(const[t,r]of o){if(r>w)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} sums to ${r}, above 1000000`);if(!e.mintPool&&r!==w)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} must sum to 1000000, got ${r}`)}return e})(t),s.ScVal.scvBytes(Buffer.from(D(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},j=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return s.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function F(e,n,i){const s=e.controllerAddress??h(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function H(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return F(t,"supply",[q(t.caller),A(o),_(r),$([...e.assets])])}function X(t,e){return H(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function K(t,e){return F(t,"borrow",[q(t.caller),A(e.accountNonce),$([...e.borrows]),O(e.to,q)])}function Z(t,e){return K(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Q(t,e){return F(t,"withdraw",[q(t.caller),A(e.accountNonce),$([...e.withdrawals]),O(e.to,q)])}function J(t,e){return Q(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Y(t,e){return F(t,"repay",[q(t.caller),A(e.accountNonce),$([...e.payments])])}function tt(t,e){return Y(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function et(t,e){return F(t,"liquidate",[q(t.caller),A(e.accountNonce),$([...e.debtPayments]),C(e.seizeMode??"Transfer")])}function ot(t){const e=i(s.ScVal.fromXDR(t,"base64"));if("bigint"==typeof e||"number"==typeof e)return e.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof e)}function rt(t,e){return F(t,"flash_loan",[q(t.caller),L(e.hubId,e.asset),T(e.amount),q(e.receiver),j(e.data)])}function nt(t,e){return F(t,"migrate_from_blend",[q(t.caller),A(e.accountId),_(e.spokeId),_(e.hubId),q(e.blendPool),R(e.collateralTokens.map(q)),R(e.supplyTokens.map(q)),(o=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(o.map((t=>{return e=t.token,o=t.amount,s.ScVal.scvVec([q(e),T(o)]);var e,o}))))]);var o}function ut(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return F(t,"multiply",[q(t.caller),A(o),_(r),L(e.collateral.hubId,e.collateral.asset),T(e.debtToFlashLoan),L(e.debt.hubId,e.debt.asset),_(e.mode),V(e.steps),O(e.initialPayment,(t=>U(t.hubId,t.asset,t.amount))),O(e.convertSwap,V)])}function it(t,e){return F(t,"swap_debt",[q(t.caller),A(e.accountNonce),L(e.existingDebt.hubId,e.existingDebt.asset),T(e.newDebtAmount),L(e.newDebt.hubId,e.newDebt.asset),V(e.steps)])}function st(t,e){return F(t,"swap_collateral",[q(t.caller),A(e.accountNonce),L(e.current.hubId,e.current.asset),T(e.fromAmount),L(e.newCollateral.hubId,e.newCollateral.asset),V(e.steps)])}function at(t,e){return F(t,"repay_debt_with_collateral",[q(t.caller),A(e.accountNonce),L(e.collateral.hubId,e.collateral.asset),T(e.collateralAmount),L(e.debt.hubId,e.debt.asset),V(e.steps),k(e.closePosition)])}const pt="/stellar-lending",lt=25,ct=encodeURIComponent,dt=(t,e)=>t.fetchWithTimeout(`${pt}/context`,e),yt=(t,e)=>t.fetchWithTimeout(`${pt}/live-state`,e),gt=(t,e)=>t.fetchWithTimeout(`${pt}/assets`,e),ft=(t,e)=>t.fetchWithTimeout(`${pt}/hubs`,e),mt=(t,e)=>t.fetchWithTimeout(`${pt}/spokes`,e),ht=(t,e={},o)=>{const{hubId:r,spokeId:n,asset:u}=e;return t.fetchWithTimeout(`${pt}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},bt=(t,e,o,r,n)=>t.fetchWithTimeout(`${pt}/reserves/${e}/${o}/${ct(r)}`,n),St=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${pt}/reserves/${e}/${o}/${ct(r)}/holders`,{...u,params:{side:n}}),xt=(t,e,o)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}`,o),vt=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}/page`,{...r,params:{...o}}),wt=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}/markets`,{...r,params:{side:o}}),qt=(t,e,o)=>t.fetchWithTimeout(`${pt}/hubs/${e}`,o),Tt=(t,e,o)=>t.fetchWithTimeout(`${pt}/spokes/${e}`,o),_t=(t,e,o)=>t.fetchWithTimeout(`${pt}/users/${ct(e)}/positions`,o),At=(t,e,o={},r)=>{const{skip:n,top:u}=o;return t.fetchWithTimeout(`${pt}/users/${ct(e)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},kt=(t,e,o)=>t.fetchWithTimeout(`${pt}/accounts/${ct(e)}/positions`,o),Pt=(t,e={},o)=>{const{top:r=lt,continuationToken:n}=e;return t.fetchWithTimeout(`${pt}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},It=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}/graph`,{...r,params:{...o}}),Et=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/hubs/${e}/graph`,{...r,params:{...o}}),Rt=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/spokes/${e}/graph`,{...r,params:{...o}}),Mt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${pt}/reserves/${e}/${o}/${ct(r)}/graph`,{...u,params:{...n}}),Ot=(t,e)=>t.fetchWithTimeout(`${pt}/protocol-config`,e),Lt=(t,e,o)=>t.fetchWithTimeout(`${pt}/protocol-config/${ct(e)}`,o),Ut=(t,e,o)=>t.fetchWithTimeout(e?`${pt}/roles?contractAddress=${ct(e)}`:`${pt}/roles`,o),$t=(t,e,o)=>t.fetchWithTimeout(`${pt}/accounts/${ct(String(e))}/delegates`,o),Ct=(t,e)=>t.fetchWithTimeout(`${pt}/blend-pools`,e),Nt=t=>({context:e=>dt(t,e),liveState:e=>yt(t,e),protocolConfig:e=>Ot(t,e),contractConfig:(e,o)=>Lt(t,e,o),contractRoles:(e,o)=>Ut(t,e,o),accountDelegates:(e,o)=>$t(t,e,o),blendPools:e=>Ct(t,e),assets:e=>gt(t,e),hubs:e=>ft(t,e),spokes:e=>mt(t,e),reserves:(e,o)=>{return void 0===(r=e)||"hubId"in r||"spokeId"in r||"asset"in r?ht(t,e,o):ht(t,{},e);var r},reserve:(e,o,r,n)=>bt(t,e,o,r,n),reserveHolders:(e,o,r,n,u)=>St(t,e,o,r,n,u),asset:(e,o)=>xt(t,e,o),assetMarkets:(e,o,r)=>wt(t,e,o,r),hub:(e,o)=>qt(t,e,o),spoke:(e,o)=>Tt(t,e,o),userPositions:(e,o)=>_t(t,e,o),userActivity:(e,o,r)=>At(t,e,o,r),accountPositions:(e,o)=>kt(t,e,o),governanceProposals:(e,o)=>Pt(t,e,o),assetGraph:(e,o,r)=>It(t,e,o,r),hubGraph:(e,o,r)=>Et(t,e,o,r),spokeGraph:(e,o,r)=>Rt(t,e,o,r),reserveGraph:(e,o,r,n,u)=>Mt(t,e,o,r,n,u)}),Bt=t=>N({base_borrow_rate:T(t.baseBorrowRateRay),max_borrow_rate:T(t.maxBorrowRateRay),max_utilization:T(t.maxUtilizationRay),mid_utilization:T(t.midUtilizationRay),optimal_utilization:T(t.optimalUtilizationRay),reserve_factor:_(t.reserveFactorBps),slope1:T(t.slope1Ray),slope2:T(t.slope2Ray),slope3:T(t.slope3Ray)}),Dt=t=>N({asset_decimals:_(t.assetDecimals),asset_id:q(t.assetId),base_borrow_rate:T(t.baseBorrowRateRay),flashloan_fee:_(t.flashloanFeeBps),is_flashloanable:k(t.isFlashloanable),max_borrow_rate:T(t.maxBorrowRateRay),max_utilization:T(t.maxUtilizationRay),mid_utilization:T(t.midUtilizationRay),optimal_utilization:T(t.optimalUtilizationRay),reserve_factor:_(t.reserveFactorBps),slope1:T(t.slope1Ray),slope2:T(t.slope2Ray),slope3:T(t.slope3Ray)}),Gt=t=>N({max_borrow_positions:_(t.maxBorrowPositions),max_supply_positions:_(t.maxSupplyPositions)}),zt=t=>{if("Token"in t&&t.Token)return R([I("Token"),q(t.Token)]);if("Ref"in t&&t.Ref)return R([I("Ref"),I(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},Wt=t=>{if("Stellar"in t)return R([I("Stellar"),q(t.Stellar)]);if("Symbol"in t)return R([I("Symbol"),I(t.Symbol)]);if("String"in t)return R([I("String"),P(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},Vt=t=>{if("Spot"===t)return R([I("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return R([I("Twap"),_(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},jt=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return R([I(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},Ft=t=>{if("Market"===t||"Fundamental"===t)return R([I(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},Ht=t=>{if("Reflector"in t){const e=t.Reflector;return R([I("Reflector"),N({asset:Wt(e.asset),contract:q(e.contract),read_mode:Vt(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return R([I("MultiFeed"),N({contract:q(e.contract),feed_id:P(e.feedId),kind:jt(e.kind),nature:Ft(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},Xt=t=>{const e=t;return N({decimals:_(e.decimals),max_stale_seconds:A(e.maxStaleSeconds),provider:Ht(e.provider)})},Kt=t=>{if("RequireDisjoint"===t)return R([I("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return R([I("AllowShared"),R(e.map((t=>N({contract:q(t.contract),kind:jt(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},Zt=t=>{const e=t,o=e.sources??[];let r,n;if("number"==typeof e.toleranceBps)r=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/r));else{const t=e.tolerance??{};r=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return N({asset_decimals:_(Number(e.assetDecimals)),independence:Kt(e.independence),max_price_stale_seconds:A(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:T(String(e.maxSanityPriceWad)),min_sanity_price_wad:T(String(e.minSanityPriceWad)),sources:R(o.map((t=>(t=>{if("Feed"in t)return R([I("Feed"),Xt(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return R([I("Scaled"),N({factor:Xt(e.factor),max_factor_wad:T(e.maxFactorWad),min_factor_wad:T(e.minFactorWad),quote:zt(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return R([I("LpShare"),N({key_a:zt(e.keyA),key_b:zt(e.keyB),kind:R([I(e.kind||"ConstantProduct")]),pool:q(e.pool),reserve_a_decimals:_(e.reserveADecimals),reserve_b_decimals:_(e.reserveBDecimals),share_decimals:_(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:N({lower_ratio_bps:_(n),upper_ratio_bps:_(r)})})},Qt=Zt;function Jt(t,e){return F(t,"upgrade",[M(e.wasmHash)])}function Yt(t,e){return F(t,"migrate",[_(e.newVersion)])}function te(t){return F(t,"pause",[])}function ee(t){return F(t,"unpause",[])}function oe(t,e){return F(t,"grant_role",[q(e.account),I(e.role)])}function re(t,e){return F(t,"revoke_role",[q(e.account),I(e.role)])}function ne(t,e){return F(t,"transfer_ownership",[q(e.newOwner),_(e.liveUntilLedger)])}function ue(t){return F(t,"accept_ownership",[])}function ie(t,e){return F(t,"set_swap_aggregator",[q(e.aggregator)])}function se(t,e){return F(t,"set_price_aggregator",[q(e.aggregator)])}const ae=ie;function pe(t,e){return F(t,"set_accumulator",[q(e.accumulator)])}function le(t,e){return F(t,"set_position_limits",[Gt(e)])}function ce(t,e){return F(t,"approve_blend_pool",[q(e.pool)])}function de(t,e){return F(t,"revoke_blend_pool",[q(e.pool)])}const ye=ce,ge=de;function fe(t,e){return F(t,"set_oracle",[zt(e.key),Zt(e.oracle)])}const me=fe;function he(t,e){const o=e.toleranceBps,r=e.upperRatioBps??1e4+o,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/r));return F(t,"set_tolerance",[zt(e.key),N({lower_ratio_bps:_(n),upper_ratio_bps:_(r)})])}function be(t,e){return F(t,"set_spoke_asset_flags",[_(e.spokeId),L(e.hubId,e.asset),k(e.paused),k(e.frozen),k(e.noSeize)])}function Se(t,e){return F(t,"set_oracle_sanity_bounds",[q(e.asset),T(e.minPriceWad),T(e.maxPriceWad)])}function xe(t,e){return F(t,"update_indexes",[q(t.caller),R(e.assets.map((t=>L(t.hubId,t.asset))))])}function ve(t,e){return F(t,"renew_account",[q(t.caller),A(e.accountNonce)])}function we(t,e){return F(t,"create_liquidity_pool",[_(e.hubId),q(e.asset),Dt(e.params)])}function qe(t,e){return F(t,"upgrade_liquidity_pool_params",[L(e.hubId,e.asset),Bt(e.params)])}function Te(t,e){return F(t,"claim_revenue",[q(t.caller),R(e.assets.map((t=>L(t.hubId,t.asset))))])}function _e(t,e){return F(t,"add_rewards",[q(t.caller),$(e.rewards)])}function Ae(t,e){return F(t,"update_account_threshold",[q(t.caller),k(e.hasRisks),R(e.accountNonces.map((t=>A(t))))])}const ke="00".repeat(32),Pe=t=>{if("string"==typeof t)return M(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},Ie=(t,...e)=>R([I(t),...e]),Ee=t=>N({new_owner:q(t.newOwner),live_until_ledger:_(t.liveUntilLedger)}),Re=t=>N({asset:q(t.asset),bonus:_(t.bonus),borrow_cap:T(t.borrowCap),can_borrow:k(t.canBorrow),can_collateral:k(t.canCollateral),frozen:k(t.frozen),hub_id:_(t.hubId),paused:k(t.paused),liquidation_fees:_(t.liquidationFees),ltv:_(t.ltv),no_seize:k(t.noSeize),spoke_id:_(t.spokeId),supply_cap:T(t.supplyCap),threshold:_(t.threshold)}),Me=t=>N({account:q(t.account),role:I(t.role)});function Oe(e,n,i){const s=e.governanceAddress??S(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Le=(t,e,o)=>Oe(t,"propose",[q(t.caller),e,Pe(o)]),Ue=(t,e,o)=>Oe(t,"execute_self",[E(),e,Pe(o)]);function $e(t,e,o){return Le(t,Ie("SetSwapAggregator",q(e.aggregator)),o)}function Ce(t,e,o){return Le(t,Ie("SetPriceAggregator",q(e.aggregator)),o)}const Ne=$e;function Be(t,e,o){return Le(t,Ie("SetAccumulator",q(e.accumulator)),o)}function De(t,e,o){return Le(t,Ie("SetPositionLimits",Gt(e)),o)}function Ge(t,e){return Le(t,Ie("CreateHub"),e)}function ze(t,e){return Le(t,Ie("AddSpoke"),e)}function We(t,e,o){return Le(t,Ie("RemoveSpoke",_(e.spokeId)),o)}function Ve(t,e,o){return Le(t,Ie("AddAssetToSpoke",Re(e)),o)}function je(t,e,o){return Le(t,Ie("EditAssetInSpoke",Re(e)),o)}function Fe(t,e,o){return Le(t,Ie("RemoveAssetFromSpoke",N({hub_asset:L((r=e).hubId,r.asset),spoke_id:_(r.spokeId)})),o);var r}function He(t,e,o){return Le(t,Ie("SetSpokeLiquidationCurve",N({hf_for_max_bonus_wad:T((r=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:_(r.liquidationBonusFactorBps),spoke_id:_(r.spokeId),target_hf_wad:T(r.targetHfWad)})),o);var r}function Xe(t,e,o){return Le(t,Ie("SetPositionManager",q(e.manager),k(e.isActive)),o)}function Ke(t,e,o){return Le(t,Ie("SetMinBorrowCollateralUsd",T(e.floorWad)),o)}function Ze(t,e,o){return Le(t,Ie("ApproveToken",q(e.token)),o)}function Qe(t,e,o){return Le(t,Ie("RevokeToken",q(e.token)),o)}function Je(t,e,o){return Le(t,Ie("ApproveBlendPool",q(e.pool)),o)}function Ye(t,e,o){return Le(t,Ie("RevokeBlendPool",q(e.pool)),o)}function to(t,e,o){return Le(t,Ie("CreateLiquidityPool",N({asset:q((r=e).asset),hub_id:_(r.hubId),params:Dt(r.params)})),o);var r}function eo(t,e,o){return Le(t,Ie("UpgradeLiquidityPoolParams",N({hub_asset:L((r=e).hubId,r.asset),params:Bt(r.params)})),o);var r}function oo(t,e,o){return Le(t,Ie("DeployPool",M(e.wasmHash)),o)}function ro(t,e,o){return Le(t,Ie("UpgradePool",M(e.wasmHash)),o)}function no(t,e,o){return Le(t,Ie("UpgradeController",M(e.wasmHash)),o)}function uo(t,e,o){return Le(t,Ie("MigrateController",_(e.newVersion)),o)}function io(t,e,o){return Le(t,Ie("TransferCtrlOwnership",Ee(e)),o)}function so(t,e,o){return Le(t,Ie("ConfigureAssetOracle",N({key:zt((r=e).key),oracle:Zt(r.oracle)})),o);var r}const ao=so;function po(t,e,o){return Le(t,Ie("EditOracleTolerance",N({key:zt((r=e).key),tolerance:_(r.tolerance)})),o);var r}function lo(t,e,o){return Le(t,Ie("UpgradeGov",M(e.wasmHash)),o)}function co(t,e,o){return Le(t,Ie("UpdateGovDelay",_(e.newDelay)),o)}function yo(t,e,o){return Le(t,Ie("GrantGovRole",Me(e)),o)}function go(t,e,o){return Le(t,Ie("RevokeGovRole",Me(e)),o)}function fo(t,e,o){return Le(t,Ie("TransferGovOwnership",Ee(e)),o)}function mo(t,e){const o=R(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),r=Pe(e.predecessor??ke);return Oe(t,"execute",[E(),q(e.target),I(e.functionName),o,r,Pe(e.salt)])}function ho(t,e,o){return Ue(t,Ie("UpgradeGov",M(e.wasmHash)),o)}function bo(t,e,o){return Ue(t,Ie("UpdateGovDelay",_(e.newDelay)),o)}function So(t,e,o){return Ue(t,Ie("GrantGovRole",Me(e)),o)}function xo(t,e,o){return Ue(t,Ie("RevokeGovRole",Me(e)),o)}function vo(t,e,o){return Ue(t,Ie("TransferGovOwnership",Ee(e)),o)}const wo=t=>R(t.map(q));function qo(t,e,o){return Oe(t,"propose_canceller_reset",[wo(e.newCancellers),Pe(o)])}function To(t,e,o){return Oe(t,"execute_canceller_reset",[O(e.executor,q),wo(e.newCancellers),Pe(o)])}function _o(t,e){return Oe(t,"set_spoke_asset_flags",[q(t.caller),_(e.spokeId),L(e.hubId,e.asset),k(e.paused),k(e.frozen),k(e.noSeize)])}function Ao(t,e){return Oe(t,"set_oracle_sanity_bounds",[q(t.caller),q(e.asset),T(e.minPriceWad),T(e.maxPriceWad)])}function ko(t){return Oe(t,"create_hub",[q(t.caller)])}function Po(t){return Oe(t,"add_spoke",[q(t.caller)])}function Io(t,e){return Oe(t,"revoke_role_immediate",[q(e.account),I(e.role)])}function Eo(t){return Oe(t,"pause",[q(t.caller)])}function Ro(t,e){return Le(t,Ie("Unpause"),e)}const Mo=t=>t.toXDR("base64"),Oo=t=>s.ScVal.fromXDR(t,"base64"),Lo=t=>t.map((t=>String(i(Oo(t))))).join(":"),Uo=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),$o=t=>Number(t),Co=t=>String(t),No=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),Bo=["None","Multiply","Long","Short"],Do=["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","liq_credit"],Go=t=>Array.isArray(t)?t:[],zo=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Do[$o(r)]??Uo(r)),positionType:e,hubId:$o(t[1]),asset:Co(t[2]),scaledAmountRay:Uo(t[3]),indexRay:Uo(t[4]),amount:Uo(t[5]),liquidationThresholdBps:o?void 0:$o(t[6]),liquidationBonusBps:o?void 0:$o(t[7]),loanToValueBps:o?void 0:$o(t[8]),liquidationFeesBps:o?void 0:$o(t[9])};var r},Wo=t=>{return{owner:Co(t[0]),spokeId:$o(t[1]),mode:(e=t[2],Bo[$o(e)]??"None")};var e},Vo=t=>Array.isArray(t)?t[1]:void 0,jo=t=>{const e=(o=t,Array.isArray(o)?Co(o[0]):Co(o));var o;if("Token"===e)return{Token:Co(Vo(t))};if("Ref"===e)return{Ref:Co(Vo(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:Co(e.Token)};if(void 0!==e.Ref)return{Ref:Co(e.Ref)}}return{Token:Co(t)}},Fo=t=>{const e=t.tolerance??{};return{assetDecimals:$o(t.asset_decimals),maxPriceStaleSeconds:$o(t.max_price_stale_seconds),sources:Go(t.sources).map((t=>t)),tolerance:{upperRatio:$o(e.upper_ratio_bps),lowerRatio:$o(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:Uo(t.min_sanity_price_wad),maxSanityPriceWad:Uo(t.max_sanity_price_wad)}},Ho={"market:create":t=>({topic:"market:create",data:{hubId:$o(t.hub_id),baseAsset:Co(t.base_asset),maxBorrowRate:Uo(t.max_borrow_rate),baseBorrowRate:Uo(t.base_borrow_rate),slope1:Uo(t.slope1),slope2:Uo(t.slope2),slope3:Uo(t.slope3),midUtilization:Uo(t.mid_utilization),optimalUtilization:Uo(t.optimal_utilization),maxUtilization:Uo(t.max_utilization),reserveFactor:$o(t.reserve_factor),marketAddress:Co(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Co(t.asset),maxBorrowRateRay:Uo(t.max_borrow_rate),baseBorrowRateRay:Uo(t.base_borrow_rate),slope1Ray:Uo(t.slope1),slope2Ray:Uo(t.slope2),slope3Ray:Uo(t.slope3),midUtilizationRay:Uo(t.mid_utilization),optimalUtilizationRay:Uo(t.optimal_utilization),maxUtilizationRay:Uo(t.max_utilization),reserveFactorBps:$o(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Go(t).map((t=>{return e=Go(t),{hubId:$o(e[0]),asset:Co(e[1]),timestamp:$o(e[2]),supplyIndexRay:Uo(e[3]),borrowIndexRay:Uo(e[4]),cash:Uo(e[5]),suppliedRay:Uo(e[6]),borrowedRay:Uo(e[7]),revenueRay:Uo(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Go(t).map((t=>{const e=t;return{hubId:$o(e.hub_id),asset:Co(e.asset),params:(o=e.params,{maxBorrowRateRay:Uo(o.max_borrow_rate),baseBorrowRateRay:Uo(o.base_borrow_rate),slope1Ray:Uo(o.slope1),slope2Ray:Uo(o.slope2),slope3Ray:Uo(o.slope3),midUtilizationRay:Uo(o.mid_utilization),optimalUtilizationRay:Uo(o.optimal_utilization),maxUtilizationRay:Uo(o.max_utilization),reserveFactorBps:$o(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:$o(o.flashloan_fee),assetId:Co(o.asset_id),assetDecimals:$o(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=Go(t);return{topic:"position:batch_update",data:{accountId:Uo(e[0]),accountAttributes:Wo(Go(e[1])),updates:[...Go(e[2]).map((t=>zo(Go(t),"Deposit"))),...Go(e[3]).map((t=>zo(Go(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:$o(t.hub_id),asset:Co(t.asset),receiver:Co(t.receiver),caller:Co(t.caller),amount:Uo(t.amount),fee:Uo(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:jo(t.key),oracle:Fo(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Co(t.asset),oracle:Fo(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:Co(t.liquidator),accountId:Uo(t.account_id),repaidUsdWad:Uo(t.repaid_usd_wad),bonusBps:Uo(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Uo(t.account_id),totalBorrowUsdWad:Uo(t.total_borrow_usd_wad),totalCollateralUsdWad:Uo(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Co(t.token),amount:Uo(t.amount),usdValueWad:Uo(t.usd_value_wad),accountId:Uo(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:$o(t.hub_id),asset:Co(t.asset),amount:Uo(t.amount),fee:Uo(t.fee),amountSent:Uo(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:Co(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:No(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:Co(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:Co(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Co(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Co(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:No(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:$o(t.max_supply_positions),maxBorrowPositions:$o(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Uo(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Co(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:$o(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:Uo(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Uo(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:$o(e.liquidation_bonus_factor_bps)}}}},Xo=Object.freeze(Object.keys(Ho));function Ko(t,e){const o=Lo(t),r=Ho[o];return r?r(i(Oo(e))):null}const Zo=1e4;function Qo(t,e){return`${t}-${BigInt(e).toString(10)}`}function Jo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function Yo(t,e=0){return t*Zo+e}function tr(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const er=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},or=t=>t.baseUrl??f[t.network];async function rr(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=er(or(e),"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function nr(t){const e=er(or(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const ur=t=>D(t).toXDR("base64");function ir(e,n){const i=e.routerAddress??b(e.network),s=new r(i),a=new t(e.caller,e.sourceSequence),p=V(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new u(a,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(s.call("execute_strategy",q(e.caller),T(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function sr(t,e){return ir(t,e)}function ar(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(cr),splitPpm:t.splitPpm}))):[{hops:t.hops.map(cr),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function pr(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:ar(t,e)}const lr=ar,cr=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function dr(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function yr(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw dr(o.invokedContractId,t);throw t}}async function gr(t,e,o){return yr(t,e.xdr,o)}function fr(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function mr(t,e){return new Uint8Array(0)}const hr=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function br(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(hr(e.message)),s.ScVal.scvBytes(hr(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:m[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Sr={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."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},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 xr(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const o=Number(e[1]),r=Sr[o];return r?{code:o,...r}:null}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var o=p[t]={exports:{}};return a[t](o,o.exports,l),o.exports}l.d=(t,e)=>{for(var o in e)l.o(e,o)&&!l.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="https://api.xoxno.com",d="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",y="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",g="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var f;!function(t){t.MAINNET="1",t.DEVNET="D"}(f||(f={}));class m{apiUrl;chain;init;config;constructor({chain:t=f.MAINNET,apiUrl:e=c,...o}={}){this.apiUrl=e??{[f.MAINNET]:c,[f.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==f.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:s,cache:a,debug:p,headers:l,method:c="GET",...d}=o,y=l?.Authorization,g="Bearer undefined"===y?void 0:y,f={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===c?{}:{"Content-Type":"application/json"},...g?{Authorization:g}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),h=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:b,...S}=r??{},{revalidate:x,...v}=s??{},w="GET"!==c||g?void 0:x??b,q="GET"!==c||g||w?void 0:a??n,T={...i,...d,method:c,...Object.keys(f).length?{headers:f}:{},cache:q,next:{...S,...v,revalidate:w}};(p??u)&&console.debug("SDK fetch: ",h,T);const _=await fetch(h,T).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${h}: ${t.message}`),{cause:t});throw t})),A=await _.text();if(!_.ok){let t;try{t=JSON.parse(A)}catch{t={message:A}}const e=[h,_.status,_.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(A)}catch{return A}}}const h=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},b=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class S extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class x extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^[GC][A-Z2-7]{55}$/.test(t)),w={"/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/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{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:{}}}},q=["PATCH","POST","DELETE","PUT"];var T=l(385);const _=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function A(t,e,o,r){const{input:n,output:u,...i}=e,s=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!v(t))throw new x(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!h(t))):!h(t))throw new S(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:y,headers:g,cache:f,next:m,debug:b,continuationToken:w,...q}=l,T=d?`Bearer ${d}`:void 0,_={...g,...T?{Authorization:T}:{},...w?{"X-Continuation-Token":String(w)}:{}},A={...m,tags:[...m?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:q,body:c,headers:_,cache:f,debug:b,...A?{next:A}:{}})},a=(t={})=>s(t);for(const t of Object.keys(i))q.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(w)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=_(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=_(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let s;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];s=A(o,n,r,t)}else{s={};for(const{rawPath:o,def:n}of e.leaves)s[_(o.split("/").pop().replace(/^:/,""))]=A(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===s[t]?s[t]=u:"function"==typeof s[t]?Object.assign(s[t],u):"function"==typeof u?(Object.assign(u,s[t]),s[t]=u):Object.assign(s[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(s[t]){const o=s[t];s[t]=t=>({...o(t),...e(t)})}else s[t]=e}return s};return o(e,{})}export{f as Chain,m as XOXNOClient,k as buildSdk,h as isValidCollectionTicker,b as isValidNftIdentifier};export const STELLAR_AGGREGATOR_ROUTER=T.ME;export const STELLAR_GOVERNANCE=T.nO;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=T.G_;export const STELLAR_LENDING_CONTROLLER=T.DU;export const STELLAR_LENDING_TOPICS=T.fA;export const STELLAR_NETWORK_PASSPHRASE=T.A$;export const STELLAR_QUOTE_URL=T.J9;export const STELLAR_SOROBAN_RPC_URL=T.hS;export const SYNTHETIC_EVENT_ORDER_STRIDE=T.gR;export const buildSameTokenRepaySwapSteps=T.VZ;export const buildStellarAcceptOwnershipTx=T.N0;export const buildStellarAddRewardsTx=T.B_;export const buildStellarApproveBlendPoolTx=T.qL;export const buildStellarApproveTokenTx=T.eX;export const buildStellarBatchSwapTx=T.z;export const buildStellarBorrowBatchTx=T.xD;export const buildStellarBorrowTx=T.jR;export const buildStellarCctpForwardTx=T.P2;export const buildStellarClaimRevenueTx=T.W6;export const buildStellarCreateLiquidityPoolTx=T.se;export const buildStellarExecuteCancellerResetTx=T.ZP;export const buildStellarExecuteStrategyTx=T.yr;export const buildStellarFlashLoanTx=T.sp;export const buildStellarGovernanceAddSpokeImmediateTx=T.Iu;export const buildStellarGovernanceCreateHubImmediateTx=T.yu;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=T.$9;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=T.zw;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=T.h_;export const buildStellarGovernanceExecuteTransferGovOwnTx=T.e_;export const buildStellarGovernanceExecuteTx=T.Tk;export const buildStellarGovernanceExecuteUpdateDelayTx=T.BA;export const buildStellarGovernancePauseTx=T.u9;export const buildStellarGovernanceRevokeRoleImmediateTx=T.bi;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=T.gc;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=T.ay;export const buildStellarGrantRoleTx=T.SX;export const buildStellarLendingIdentifier=T.UF;export const buildStellarLiquidateTx=T.Y5;export const buildStellarMigrateFromBlendTx=T.mE;export const buildStellarMigrateTx=T.xG;export const buildStellarMultiplyTx=T.s9;export const buildStellarPauseTx=T.OL;export const buildStellarProposeAddAssetToSpokeTx=T.k6;export const buildStellarProposeAddSpokeTx=T.dj;export const buildStellarProposeApproveBlendPoolTx=T.kD;export const buildStellarProposeApproveTokenTx=T.Yf;export const buildStellarProposeCancellerResetTx=T.AI;export const buildStellarProposeConfigureAssetOracleTx=T.O2;export const buildStellarProposeConfigureMarketOracleTx=T.c5;export const buildStellarProposeCreateHubTx=T.N8;export const buildStellarProposeCreateLiquidityPoolTx=T.qU;export const buildStellarProposeDeployPoolTx=T.RZ;export const buildStellarProposeEditAssetInSpokeTx=T.ni;export const buildStellarProposeEditOracleToleranceTx=T.hF;export const buildStellarProposeGovernanceUpgradeTx=T.Qk;export const buildStellarProposeGrantGovernanceRoleTx=T.Gw;export const buildStellarProposeMigrateControllerTx=T.$K;export const buildStellarProposeRemoveAssetFromSpokeTx=T.uj;export const buildStellarProposeRemoveSpokeTx=T.Od;export const buildStellarProposeRevokeBlendPoolTx=T.X7;export const buildStellarProposeRevokeGovernanceRoleTx=T.Ub;export const buildStellarProposeRevokeTokenTx=T.Dx;export const buildStellarProposeSetAccumulatorTx=T.OA;export const buildStellarProposeSetAggregatorTx=T.$U;export const buildStellarProposeSetMinBorrowCollatTx=T.ob;export const buildStellarProposeSetPositionLimitsTx=T.$l;export const buildStellarProposeSetPositionManagerTx=T.K;export const buildStellarProposeSetPriceAggregatorTx=T.Wb;export const buildStellarProposeSetSpokeLiquidationCurveTx=T.kw;export const buildStellarProposeSetSwapAggregatorTx=T.qA;export const buildStellarProposeTransferCtrlOwnershipTx=T.VS;export const buildStellarProposeTransferGovOwnTx=T.HP;export const buildStellarProposeUnpauseTx=T.xQ;export const buildStellarProposeUpdateDelayTx=T.YQ;export const buildStellarProposeUpgradeControllerTx=T.QY;export const buildStellarProposeUpgradePoolParamsTx=T.os;export const buildStellarProposeUpgradePoolTx=T.Ko;export const buildStellarRenewAccountTx=T.IJ;export const buildStellarRepayBatchTx=T.nw;export const buildStellarRepayDebtWithCollateralTx=T.Pr;export const buildStellarRepayTx=T.ZE;export const buildStellarRevokeBlendPoolTx=T.X0;export const buildStellarRevokeRoleTx=T.ev;export const buildStellarRevokeTokenTx=T.P8;export const buildStellarSetAccumulatorTx=T.aV;export const buildStellarSetAggregatorTx=T.p2;export const buildStellarSetMarketOracleConfigTx=T.sV;export const buildStellarSetOracleSanityBoundsTx=T.XD;export const buildStellarSetOracleToleranceTx=T.Js;export const buildStellarSetOracleTx=T.W5;export const buildStellarSetPositionLimitsTx=T.Dy;export const buildStellarSetPriceAggregatorTx=T._i;export const buildStellarSetSpokeAssetFlagsTx=T.FZ;export const buildStellarSetSwapAggregatorTx=T.wG;export const buildStellarSupplyBatchTx=T.Ni;export const buildStellarSupplyTx=T.v_;export const buildStellarSwapCollateralTx=T.qD;export const buildStellarSwapDebtTx=T.qR;export const buildStellarTransferOwnershipTx=T.QJ;export const buildStellarUnpauseTx=T.bm;export const buildStellarUpdateAccountThresholdTx=T.n_;export const buildStellarUpdateIndexesTx=T.v8;export const buildStellarUpgradeControllerTx=T.qM;export const buildStellarUpgradeLiquidityPoolParamsTx=T.gH;export const buildStellarWithdrawBatchTx=T.O3;export const buildStellarWithdrawTx=T.Gz;export const buildTx=T.pr;export const decodeStellarLendingEvent=T.Fm;export const decodeStellarLiquidateReturn=T.OB;export const encodeAssetOracle=T.Ft;export const encodeInterestRateModel=T.MB;export const encodeMarketOracleConfigInput=T.Dn;export const encodeMarketParamsRaw=T.pq;export const encodePositionLimits=T.Q3;export const encodePriceKey=T.Jh;export const encodeStrategyPayloadToRouteXdr=T.wf;export const extractEventOrder=T.Um;export const getStellarAccountDelegates=T.XR;export const getStellarAccountPositions=T.xO;export const getStellarAggregatorQuote=T.Lw;export const getStellarAggregatorRouter=T.KM;export const getStellarAsset=T.mM;export const getStellarAssetGraph=T.iE;export const getStellarAssetMarkets=T.zp;export const getStellarAssetPage=T.N3;export const getStellarAssets=T.bN;export const getStellarBlendPools=T.cK;export const getStellarContractConfig=T.kV;export const getStellarContractRoles=T.vo;export const getStellarGovernance=T.QV;export const getStellarGovernanceProposals=T.T_;export const getStellarHub=T.XI;export const getStellarHubGraph=T.Lt;export const getStellarHubs=T.KK;export const getStellarLendingContext=T.yl;export const getStellarLendingController=T.vc;export const getStellarLendingLiveState=T.kq;export const getStellarProtocolConfig=T.Mi;export const getStellarQuoteTokens=T.CH;export const getStellarReserve=T.FI;export const getStellarReserveGraph=T.KG;export const getStellarReserveHolders=T.nW;export const getStellarReserves=T.jF;export const getStellarSpoke=T.S2;export const getStellarSpokeGraph=T.uS;export const getStellarSpokes=T.u_;export const getStellarUserActivity=T.O5;export const getStellarUserPositions=T.Av;export const mapQuoteResponseToAggregatorSwap=T.LA;export const mapQuoteResponseToStrategyPayload=T.E6;export const mapQuoteResponseToStrategySwap=T.Ds;export const mapSorobanError=T.XV;export const mapStellarPositionActivityType=T.CU;export const prepareStellarBuiltTx=T.Vx;export const prepareStellarTxXdr=T.DL;export const stellarLendingDispatchKey=T.ON;export const stellarLendingRead=T.Hh;export const syntheticEventOrder=T.oV;export const tagStellarInvokedContractError=T.g5;export const toBase64Xdr=T.L;export const toStellarPositionMode=T.Vu;
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as i,xdr as s}from"@stellar/stellar-sdk";var a={385(a,p,l){l.d(p,{ME:()=>d,nO:()=>y,G_:()=>ke,DU:()=>c,fA:()=>Xo,A$:()=>m,J9:()=>f,hS:()=>g,gR:()=>Ko,VZ:()=>mr,N0:()=>ue,B_:()=>_e,qL:()=>ce,eX:()=>ye,z:()=>sr,xD:()=>Z,jR:()=>K,P2:()=>br,W6:()=>Te,se:()=>we,ZP:()=>To,yr:()=>ir,sp:()=>rt,Iu:()=>Po,yu:()=>ko,$9:()=>ho,zw:()=>So,h_:()=>xo,e_:()=>vo,Tk:()=>mo,BA:()=>bo,u9:()=>Eo,bi:()=>Io,gc:()=>Ao,ay:()=>_o,SX:()=>oe,UF:()=>Qo,Y5:()=>et,mE:()=>nt,xG:()=>Yt,s9:()=>ut,OL:()=>te,k6:()=>Ve,dj:()=>ze,kD:()=>Je,Yf:()=>Ke,AI:()=>qo,O2:()=>so,c5:()=>ao,N8:()=>Ge,qU:()=>to,RZ:()=>oo,ni:()=>je,hF:()=>po,Qk:()=>lo,Gw:()=>yo,$K:()=>uo,uj:()=>Fe,Od:()=>We,X7:()=>Ye,Ub:()=>go,Dx:()=>Qe,OA:()=>Be,$U:()=>Ne,ob:()=>Ze,$l:()=>De,K:()=>Xe,Wb:()=>Ue,kw:()=>He,qA:()=>Le,VS:()=>io,HP:()=>fo,xQ:()=>Ro,YQ:()=>co,QY:()=>no,os:()=>eo,Ko:()=>ro,IJ:()=>ve,nw:()=>Y,Pr:()=>at,ZE:()=>tt,X0:()=>de,ev:()=>re,P8:()=>ge,aV:()=>pe,p2:()=>ae,sV:()=>me,XD:()=>Se,Js:()=>he,W5:()=>fe,Dy:()=>le,_i:()=>se,FZ:()=>be,wG:()=>ie,Ni:()=>H,v_:()=>X,qD:()=>st,qR:()=>it,QJ:()=>ne,bm:()=>ee,n_:()=>Ae,v8:()=>xe,qM:()=>Jt,gH:()=>qe,O3:()=>Q,Gz:()=>J,pr:()=>F,Fm:()=>Zo,OB:()=>ot,Ft:()=>Kt,MB:()=>Bt,Dn:()=>Qt,pq:()=>Dt,Q3:()=>Gt,Jh:()=>zt,wf:()=>ur,Um:()=>Jo,XR:()=>Lt,xO:()=>kt,Lw:()=>rr,KM:()=>b,mM:()=>xt,iE:()=>It,zp:()=>wt,N3:()=>vt,bN:()=>gt,cK:()=>Ut,kV:()=>$t,vo:()=>Ct,QV:()=>S,T_:()=>Pt,XI:()=>qt,Lt:()=>Et,KK:()=>ft,yl:()=>dt,vc:()=>h,kq:()=>yt,Mi:()=>Ot,CH:()=>nr,FI:()=>bt,KG:()=>Mt,nW:()=>St,jF:()=>ht,S2:()=>Tt,uS:()=>Rt,u_:()=>mt,O5:()=>At,Av:()=>_t,LA:()=>lr,E6:()=>ar,Ds:()=>pr,XV:()=>xr,CU:()=>tr,Vx:()=>gr,DL:()=>yr,ON:()=>$o,Hh:()=>Nt,oV:()=>Yo,g5:()=>dr,L:()=>Mo,Vu:()=>fr});const c={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},d={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},y={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},g={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},f={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},m={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function h(t){const e=c[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function b(t){const e=d[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function S(t){const e=y[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const x=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],v={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},w=1e6,q=t=>new e(t).toScVal(),T=t=>new n(t).toI128(),_=t=>s.ScVal.scvU32(t),A=t=>new n("string"==typeof t?t:t.toString()).toU64(),k=t=>s.ScVal.scvBool(t),P=t=>s.ScVal.scvString(t),I=t=>s.ScVal.scvSymbol(t),E=()=>s.ScVal.scvVoid(),R=t=>s.ScVal.scvVec(t),M=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return s.ScVal.scvBytes(r)},O=(t,e)=>null==t?E():e(t),$=(t,e)=>N({asset:q(e),hub_id:_(t)}),C=(t,e,o)=>s.ScVal.scvVec([$(t,e),T(o)]),L=t=>s.ScVal.scvVec(t.map((t=>C(t.hubId,t.asset,t.amount)))),U=t=>{if("Transfer"===t)return R([I("Transfer")]);if(t&&"object"==typeof t&&"Credit"in t){const e=t.Credit;if("number"==typeof e&&!Number.isInteger(e))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${e}`);return R([I("Credit"),A(e)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(t)}`)},N=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:I(e),val:t[e]})));return s.ScVal.scvMap(e)};class B{assets=[];amounts=[];ops=[];weights=[];constructor(t){this.amounts.push(t)}asset(t){const e=this.assets.indexOf(t);if(-1!==e)return e;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(t),this.assets.length-1}amount(t){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(t),this.amounts.length-1}weight(t){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(t)||t<=0||t>w)throw new Error(`Stellar builder: split weight ${t} outside 1..=1000000`);return this.weights.push(t),this.weights.length-1}emit(t,e,o,r,n){this.ops.push([t,e,o,r,n])}emitPath(t,e){t.hops.forEach(((o,r)=>{if(o.tokenIn===o.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=t.hops[r-1];if(n&&o.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(v[o.venue],0===r?e:1,this.asset(o.pool),this.asset(o.tokenIn),this.asset(o.tokenOut))}))}lowerPaths(t){const e=t.filter((t=>t.hops.length>0)),o=Array.from({length:e.length},(()=>!1));for(let t=0;t<e.length;t+=1){if(o[t])continue;const r=e[t].hops[0]?.tokenIn,n=[];for(let o=t;o<e.length;o+=1)e[o].hops[0]?.tokenIn===r&&n.push(o);const u=n.reduce(((t,o)=>t+e[o].splitPpm),0);if(u>w)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const i=u===w;let s=w;n.forEach(((t,r)=>{o[t]=!0;const u=e[t];let a;if(r+1===n.length&&i)a=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const t=Math.floor(u.splitPpm*w/s);s-=Math.min(u.splitPpm,s),a=128+this.weight(t)}this.emitPath(u,a)}))}}toBytes(t,e,o){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 r=[1,t,e,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,this.ops.length,this.weights.length];for(const t of this.ops)r.push(...t);for(const t of this.weights)r.push(t>>>16&255,t>>>8&255,255&t);return Buffer.from(r)}get assetList(){return this.assets}get amountList(){return this.amounts}}const D=t=>{const e=new B(t.totalMinOut),o=e.asset(t.tokenIn),r=e.asset(t.tokenOut);if(o===r)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(t.burnPool){const r=e.asset(t.burnPool),n=e.amountList.length;for(const o of t.burnMinAmounts??[])e.amount(o);e.emit(5,0,r,o,n)}if(e.lowerPaths(t.paths),t.mintPool){const o=t.preSwapAmount;if(o&&BigInt(o)>0n){const r=t.mintPoolTokens;if(!r||2!==r.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=r,[i,s]=t.preSwapFromA?[n,u]:[u,n];e.emit(v.Aquarius,2+e.amount(o),e.asset(t.mintPool),e.asset(i),e.asset(s))}e.emit(6,0,e.asset(t.mintPool),r,e.amount(t.mintMinShares??"1"))}const n=Number(t.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${t.referralId} does not fit the wire’s u32`);return N({amounts:s.ScVal.scvVec(e.amountList.map((t=>T(t)))),assets:s.ScVal.scvVec(e.assetList.map((t=>q(t)))),ops:s.ScVal.scvBytes(e.toBytes(o,r,n))})},G=t=>{const e=Buffer.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},z=()=>s.ScVal.scvBytes(Buffer.alloc(0)),W=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},V=t=>{if("string"==typeof t)return G(W(t));if(t instanceof Uint8Array)return 0===t.length?z():G(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?G(W(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?G(W(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?G(W(t.bytes)):0===t.bytes.length?z():G(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const o=new Map;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!x.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const e=r.hops[0];o.set(e.tokenIn,(o.get(e.tokenIn)??0)+r.splitPpm)}for(const[t,r]of o){if(r>w)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} sums to ${r}, above 1000000`);if(!e.mintPool&&r!==w)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} must sum to 1000000, got ${r}`)}return e})(t),s.ScVal.scvBytes(Buffer.from(D(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},j=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return s.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function F(e,n,i){const s=e.controllerAddress??h(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function H(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return F(t,"supply",[q(t.caller),A(o),_(r),L([...e.assets])])}function X(t,e){return H(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function Z(t,e){return F(t,"borrow",[q(t.caller),A(e.accountNonce),L([...e.borrows]),O(e.to,q)])}function K(t,e){return Z(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Q(t,e){return F(t,"withdraw",[q(t.caller),A(e.accountNonce),L([...e.withdrawals]),O(e.to,q)])}function J(t,e){return Q(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Y(t,e){return F(t,"repay",[q(t.caller),A(e.accountNonce),L([...e.payments])])}function tt(t,e){return Y(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function et(t,e){return F(t,"liquidate",[q(t.caller),A(e.accountNonce),L([...e.debtPayments]),U(e.seizeMode??"Transfer")])}function ot(t){const e=i(s.ScVal.fromXDR(t,"base64"));if("bigint"==typeof e||"number"==typeof e)return e.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof e)}function rt(t,e){return F(t,"flash_loan",[q(t.caller),$(e.hubId,e.asset),T(e.amount),q(e.receiver),j(e.data)])}function nt(t,e){return F(t,"migrate_from_blend",[q(t.caller),A(e.accountId),_(e.spokeId),_(e.hubId),q(e.blendPool),R(e.collateralTokens.map(q)),R(e.supplyTokens.map(q)),(o=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(o.map((t=>{return e=t.token,o=t.amount,s.ScVal.scvVec([q(e),T(o)]);var e,o}))))]);var o}function ut(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return F(t,"multiply",[q(t.caller),A(o),_(r),$(e.collateral.hubId,e.collateral.asset),T(e.debtToFlashLoan),$(e.debt.hubId,e.debt.asset),_(e.mode),V(e.steps),O(e.initialPayment,(t=>C(t.hubId,t.asset,t.amount))),O(e.convertSwap,V)])}function it(t,e){return F(t,"swap_debt",[q(t.caller),A(e.accountNonce),$(e.existingDebt.hubId,e.existingDebt.asset),T(e.newDebtAmount),$(e.newDebt.hubId,e.newDebt.asset),V(e.steps)])}function st(t,e){return F(t,"swap_collateral",[q(t.caller),A(e.accountNonce),$(e.current.hubId,e.current.asset),T(e.fromAmount),$(e.newCollateral.hubId,e.newCollateral.asset),V(e.steps)])}function at(t,e){return F(t,"repay_debt_with_collateral",[q(t.caller),A(e.accountNonce),$(e.collateral.hubId,e.collateral.asset),T(e.collateralAmount),$(e.debt.hubId,e.debt.asset),V(e.steps),k(e.closePosition)])}const pt="/stellar-lending",lt=25,ct=encodeURIComponent,dt=(t,e)=>t.fetchWithTimeout(`${pt}/context`,e),yt=(t,e)=>t.fetchWithTimeout(`${pt}/live-state`,e),gt=(t,e)=>t.fetchWithTimeout(`${pt}/assets`,e),ft=(t,e)=>t.fetchWithTimeout(`${pt}/hubs`,e),mt=(t,e)=>t.fetchWithTimeout(`${pt}/spokes`,e),ht=(t,e={},o)=>{const{hubId:r,spokeId:n,asset:u}=e;return t.fetchWithTimeout(`${pt}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},bt=(t,e,o,r,n)=>t.fetchWithTimeout(`${pt}/reserves/${e}/${o}/${ct(r)}`,n),St=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${pt}/reserves/${e}/${o}/${ct(r)}/holders`,{...u,params:{side:n}}),xt=(t,e,o)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}`,o),vt=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}/page`,{...r,params:{...o}}),wt=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}/markets`,{...r,params:{side:o}}),qt=(t,e,o)=>t.fetchWithTimeout(`${pt}/hubs/${e}`,o),Tt=(t,e,o)=>t.fetchWithTimeout(`${pt}/spokes/${e}`,o),_t=(t,e,o)=>t.fetchWithTimeout(`${pt}/users/${ct(e)}/positions`,o),At=(t,e,o={},r)=>{const{skip:n,top:u}=o;return t.fetchWithTimeout(`${pt}/users/${ct(e)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},kt=(t,e,o)=>t.fetchWithTimeout(`${pt}/accounts/${ct(e)}/positions`,o),Pt=(t,e={},o)=>{const{top:r=lt,continuationToken:n}=e;return t.fetchWithTimeout(`${pt}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},It=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/assets/${ct(e)}/graph`,{...r,params:{...o}}),Et=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/hubs/${e}/graph`,{...r,params:{...o}}),Rt=(t,e,o,r)=>t.fetchWithTimeout(`${pt}/spokes/${e}/graph`,{...r,params:{...o}}),Mt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${pt}/reserves/${e}/${o}/${ct(r)}/graph`,{...u,params:{...n}}),Ot=(t,e)=>t.fetchWithTimeout(`${pt}/protocol-config`,e),$t=(t,e,o)=>t.fetchWithTimeout(`${pt}/protocol-config/${ct(e)}`,o),Ct=(t,e,o)=>t.fetchWithTimeout(e?`${pt}/roles?contractAddress=${ct(e)}`:`${pt}/roles`,o),Lt=(t,e,o)=>t.fetchWithTimeout(`${pt}/accounts/${ct(String(e))}/delegates`,o),Ut=(t,e)=>t.fetchWithTimeout(`${pt}/blend-pools`,e),Nt=t=>({context:e=>dt(t,e),liveState:e=>yt(t,e),protocolConfig:e=>Ot(t,e),contractConfig:(e,o)=>$t(t,e,o),contractRoles:(e,o)=>Ct(t,e,o),accountDelegates:(e,o)=>Lt(t,e,o),blendPools:e=>Ut(t,e),assets:e=>gt(t,e),hubs:e=>ft(t,e),spokes:e=>mt(t,e),reserves:(e,o)=>{return void 0===(r=e)||"hubId"in r||"spokeId"in r||"asset"in r?ht(t,e,o):ht(t,{},e);var r},reserve:(e,o,r,n)=>bt(t,e,o,r,n),reserveHolders:(e,o,r,n,u)=>St(t,e,o,r,n,u),asset:(e,o)=>xt(t,e,o),assetMarkets:(e,o,r)=>wt(t,e,o,r),hub:(e,o)=>qt(t,e,o),spoke:(e,o)=>Tt(t,e,o),userPositions:(e,o)=>_t(t,e,o),userActivity:(e,o,r)=>At(t,e,o,r),accountPositions:(e,o)=>kt(t,e,o),governanceProposals:(e,o)=>Pt(t,e,o),assetGraph:(e,o,r)=>It(t,e,o,r),hubGraph:(e,o,r)=>Et(t,e,o,r),spokeGraph:(e,o,r)=>Rt(t,e,o,r),reserveGraph:(e,o,r,n,u)=>Mt(t,e,o,r,n,u)}),Bt=t=>N({base_borrow_rate:T(t.baseBorrowRateRay),max_borrow_rate:T(t.maxBorrowRateRay),max_utilization:T(t.maxUtilizationRay),mid_utilization:T(t.midUtilizationRay),optimal_utilization:T(t.optimalUtilizationRay),reserve_factor:_(t.reserveFactorBps),slope1:T(t.slope1Ray),slope2:T(t.slope2Ray),slope3:T(t.slope3Ray)}),Dt=t=>N({asset_decimals:_(t.assetDecimals),asset_id:q(t.assetId),base_borrow_rate:T(t.baseBorrowRateRay),flashloan_fee:_(t.flashloanFeeBps),is_flashloanable:k(t.isFlashloanable),max_borrow_rate:T(t.maxBorrowRateRay),max_utilization:T(t.maxUtilizationRay),mid_utilization:T(t.midUtilizationRay),optimal_utilization:T(t.optimalUtilizationRay),reserve_factor:_(t.reserveFactorBps),slope1:T(t.slope1Ray),slope2:T(t.slope2Ray),slope3:T(t.slope3Ray)}),Gt=t=>N({max_borrow_positions:_(t.maxBorrowPositions),max_supply_positions:_(t.maxSupplyPositions)}),zt=t=>{if("Token"in t&&t.Token)return R([I("Token"),q(t.Token)]);if("Ref"in t&&t.Ref)return R([I("Ref"),I(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},Wt=t=>{if("Stellar"in t)return R([I("Stellar"),q(t.Stellar)]);if("Symbol"in t)return R([I("Symbol"),I(t.Symbol)]);if("String"in t)return R([I("String"),P(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},Vt=t=>{if("Spot"===t)return R([I("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return R([I("Twap"),_(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},jt=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return R([I(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},Ft=t=>{if("Market"===t||"Fundamental"===t)return R([I(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},Ht=t=>{if("Reflector"in t){const e=t.Reflector;return R([I("Reflector"),N({asset:Wt(e.asset),contract:q(e.contract),read_mode:Vt(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return R([I("MultiFeed"),N({contract:q(e.contract),feed_id:P(e.feedId),kind:jt(e.kind),nature:Ft(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},Xt=t=>{const e=t;return N({decimals:_(e.decimals),max_stale_seconds:A(e.maxStaleSeconds),provider:Ht(e.provider)})},Zt=t=>{if("RequireDisjoint"===t)return R([I("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return R([I("AllowShared"),R(e.map((t=>N({contract:q(t.contract),kind:jt(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},Kt=t=>{const e=t,o=e.sources??[];let r,n;if("number"==typeof e.toleranceBps)r=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/r));else{const t=e.tolerance??{};r=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return N({asset_decimals:_(Number(e.assetDecimals)),independence:Zt(e.independence),max_price_stale_seconds:A(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:T(String(e.maxSanityPriceWad)),min_sanity_price_wad:T(String(e.minSanityPriceWad)),sources:R(o.map((t=>(t=>{if("Feed"in t)return R([I("Feed"),Xt(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return R([I("Scaled"),N({factor:Xt(e.factor),max_factor_wad:T(e.maxFactorWad),min_factor_wad:T(e.minFactorWad),quote:zt(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return R([I("LpShare"),N({key_a:zt(e.keyA),key_b:zt(e.keyB),kind:R([I(e.kind||"ConstantProduct")]),pool:q(e.pool),reserve_a_decimals:_(e.reserveADecimals),reserve_b_decimals:_(e.reserveBDecimals),share_decimals:_(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:N({lower_ratio_bps:_(n),upper_ratio_bps:_(r)})})},Qt=Kt;function Jt(t,e){return F(t,"upgrade",[M(e.wasmHash)])}function Yt(t,e){return F(t,"migrate",[_(e.newVersion)])}function te(t){return F(t,"pause",[])}function ee(t){return F(t,"unpause",[])}function oe(t,e){return F(t,"grant_role",[q(e.account),I(e.role)])}function re(t,e){return F(t,"revoke_role",[q(e.account),I(e.role)])}function ne(t,e){return F(t,"transfer_ownership",[q(e.newOwner),_(e.liveUntilLedger)])}function ue(t){return F(t,"accept_ownership",[])}function ie(t,e){return F(t,"set_swap_aggregator",[q(e.aggregator)])}function se(t,e){return F(t,"set_price_aggregator",[q(e.aggregator)])}const ae=ie;function pe(t,e){return F(t,"set_accumulator",[q(e.accumulator)])}function le(t,e){return F(t,"set_position_limits",[Gt(e)])}function ce(t,e){return F(t,"approve_blend_pool",[q(e.pool)])}function de(t,e){return F(t,"revoke_blend_pool",[q(e.pool)])}const ye=ce,ge=de;function fe(t,e){return F(t,"set_oracle",[zt(e.key),Kt(e.oracle)])}const me=fe;function he(t,e){const o=e.toleranceBps,r=e.upperRatioBps??1e4+o,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/r));return F(t,"set_tolerance",[zt(e.key),N({lower_ratio_bps:_(n),upper_ratio_bps:_(r)})])}function be(t,e){return F(t,"set_spoke_asset_flags",[_(e.spokeId),$(e.hubId,e.asset),k(e.paused),k(e.frozen),k(e.noSeize)])}function Se(t,e){return F(t,"set_oracle_sanity_bounds",[q(e.asset),T(e.minPriceWad),T(e.maxPriceWad)])}function xe(t,e){return F(t,"update_indexes",[q(t.caller),R(e.assets.map((t=>$(t.hubId,t.asset))))])}function ve(t,e){return F(t,"renew_account",[q(t.caller),A(e.accountNonce)])}function we(t,e){return F(t,"create_liquidity_pool",[_(e.hubId),q(e.asset),Dt(e.params)])}function qe(t,e){return F(t,"upgrade_liquidity_pool_params",[$(e.hubId,e.asset),Bt(e.params)])}function Te(t,e){return F(t,"claim_revenue",[q(t.caller),R(e.assets.map((t=>$(t.hubId,t.asset))))])}function _e(t,e){return F(t,"add_rewards",[q(t.caller),L(e.rewards)])}function Ae(t,e){return F(t,"update_account_threshold",[q(t.caller),k(e.hasRisks),R(e.accountNonces.map((t=>A(t))))])}const ke="00".repeat(32),Pe=t=>{if("string"==typeof t)return M(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},Ie=(t,...e)=>R([I(t),...e]),Ee=t=>N({new_owner:q(t.newOwner),live_until_ledger:_(t.liveUntilLedger)}),Re=t=>N({asset:q(t.asset),bonus:_(t.bonus),borrow_cap:T(t.borrowCap),can_borrow:k(t.canBorrow),can_collateral:k(t.canCollateral),frozen:k(t.frozen),hub_id:_(t.hubId),paused:k(t.paused),liquidation_fees:_(t.liquidationFees),ltv:_(t.ltv),no_seize:k(t.noSeize),spoke_id:_(t.spokeId),supply_cap:T(t.supplyCap),threshold:_(t.threshold)}),Me=t=>N({account:q(t.account),role:I(t.role)});function Oe(e,n,i){const s=e.governanceAddress??S(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const $e=(t,e,o)=>Oe(t,"propose",[q(t.caller),e,Pe(o)]),Ce=(t,e,o)=>Oe(t,"execute_self",[E(),e,Pe(o)]);function Le(t,e,o){return $e(t,Ie("SetSwapAggregator",q(e.aggregator)),o)}function Ue(t,e,o){return $e(t,Ie("SetPriceAggregator",q(e.aggregator)),o)}const Ne=Le;function Be(t,e,o){return $e(t,Ie("SetAccumulator",q(e.accumulator)),o)}function De(t,e,o){return $e(t,Ie("SetPositionLimits",Gt(e)),o)}function Ge(t,e){return $e(t,Ie("CreateHub"),e)}function ze(t,e){return $e(t,Ie("AddSpoke"),e)}function We(t,e,o){return $e(t,Ie("RemoveSpoke",_(e.spokeId)),o)}function Ve(t,e,o){return $e(t,Ie("AddAssetToSpoke",Re(e)),o)}function je(t,e,o){return $e(t,Ie("EditAssetInSpoke",Re(e)),o)}function Fe(t,e,o){return $e(t,Ie("RemoveAssetFromSpoke",N({hub_asset:$((r=e).hubId,r.asset),spoke_id:_(r.spokeId)})),o);var r}function He(t,e,o){return $e(t,Ie("SetSpokeLiquidationCurve",N({hf_for_max_bonus_wad:T((r=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:_(r.liquidationBonusFactorBps),spoke_id:_(r.spokeId),target_hf_wad:T(r.targetHfWad)})),o);var r}function Xe(t,e,o){return $e(t,Ie("SetPositionManager",q(e.manager),k(e.isActive)),o)}function Ze(t,e,o){return $e(t,Ie("SetMinBorrowCollateralUsd",T(e.floorWad)),o)}function Ke(t,e,o){return $e(t,Ie("ApproveToken",q(e.token)),o)}function Qe(t,e,o){return $e(t,Ie("RevokeToken",q(e.token)),o)}function Je(t,e,o){return $e(t,Ie("ApproveBlendPool",q(e.pool)),o)}function Ye(t,e,o){return $e(t,Ie("RevokeBlendPool",q(e.pool)),o)}function to(t,e,o){return $e(t,Ie("CreateLiquidityPool",N({asset:q((r=e).asset),hub_id:_(r.hubId),params:Dt(r.params)})),o);var r}function eo(t,e,o){return $e(t,Ie("UpgradeLiquidityPoolParams",N({hub_asset:$((r=e).hubId,r.asset),params:Bt(r.params)})),o);var r}function oo(t,e,o){return $e(t,Ie("DeployPool",M(e.wasmHash)),o)}function ro(t,e,o){return $e(t,Ie("UpgradePool",M(e.wasmHash)),o)}function no(t,e,o){return $e(t,Ie("UpgradeController",M(e.wasmHash)),o)}function uo(t,e,o){return $e(t,Ie("MigrateController",_(e.newVersion)),o)}function io(t,e,o){return $e(t,Ie("TransferCtrlOwnership",Ee(e)),o)}function so(t,e,o){return $e(t,Ie("ConfigureAssetOracle",N({key:zt((r=e).key),oracle:Kt(r.oracle)})),o);var r}const ao=so;function po(t,e,o){return $e(t,Ie("EditOracleTolerance",N({key:zt((r=e).key),tolerance:_(r.tolerance)})),o);var r}function lo(t,e,o){return $e(t,Ie("UpgradeGov",M(e.wasmHash)),o)}function co(t,e,o){return $e(t,Ie("UpdateGovDelay",_(e.newDelay)),o)}function yo(t,e,o){return $e(t,Ie("GrantGovRole",Me(e)),o)}function go(t,e,o){return $e(t,Ie("RevokeGovRole",Me(e)),o)}function fo(t,e,o){return $e(t,Ie("TransferGovOwnership",Ee(e)),o)}function mo(t,e){const o=R(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),r=Pe(e.predecessor??ke);return Oe(t,"execute",[E(),q(e.target),I(e.functionName),o,r,Pe(e.salt)])}function ho(t,e,o){return Ce(t,Ie("UpgradeGov",M(e.wasmHash)),o)}function bo(t,e,o){return Ce(t,Ie("UpdateGovDelay",_(e.newDelay)),o)}function So(t,e,o){return Ce(t,Ie("GrantGovRole",Me(e)),o)}function xo(t,e,o){return Ce(t,Ie("RevokeGovRole",Me(e)),o)}function vo(t,e,o){return Ce(t,Ie("TransferGovOwnership",Ee(e)),o)}const wo=t=>R(t.map(q));function qo(t,e,o){return Oe(t,"propose_canceller_reset",[wo(e.newCancellers),Pe(o)])}function To(t,e,o){return Oe(t,"execute_canceller_reset",[O(e.executor,q),wo(e.newCancellers),Pe(o)])}function _o(t,e){return Oe(t,"set_spoke_asset_flags",[q(t.caller),_(e.spokeId),$(e.hubId,e.asset),k(e.paused),k(e.frozen),k(e.noSeize)])}function Ao(t,e){return Oe(t,"set_oracle_sanity_bounds",[q(t.caller),q(e.asset),T(e.minPriceWad),T(e.maxPriceWad)])}function ko(t){return Oe(t,"create_hub",[q(t.caller)])}function Po(t){return Oe(t,"add_spoke",[q(t.caller)])}function Io(t,e){return Oe(t,"revoke_role_immediate",[q(e.account),I(e.role)])}function Eo(t){return Oe(t,"pause",[q(t.caller)])}function Ro(t,e){return $e(t,Ie("Unpause"),e)}const Mo=t=>t.toXDR("base64"),Oo=t=>s.ScVal.fromXDR(t,"base64"),$o=t=>t.map((t=>String(i(Oo(t))))).join(":"),Co=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Lo=t=>Number(t),Uo=t=>String(t),No=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),Bo=["None","Multiply","Long","Short"],Do=["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","liq_credit"],Go=t=>Array.isArray(t)?t:[],zo=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Do[Lo(r)]??Co(r)),positionType:e,hubId:Lo(t[1]),asset:Uo(t[2]),scaledAmountRay:Co(t[3]),indexRay:Co(t[4]),amount:Co(t[5]),liquidationThresholdBps:o?void 0:Lo(t[6]),liquidationBonusBps:o?void 0:Lo(t[7]),loanToValueBps:o?void 0:Lo(t[8]),liquidationFeesBps:o?void 0:Lo(t[9])};var r},Wo=t=>{return{owner:Uo(t[0]),spokeId:Lo(t[1]),mode:(e=t[2],Bo[Lo(e)]??"None")};var e},Vo=t=>Array.isArray(t)?t[1]:void 0,jo=t=>{const e=(o=t,Array.isArray(o)?Uo(o[0]):Uo(o));var o;if("Token"===e)return{Token:Uo(Vo(t))};if("Ref"===e)return{Ref:Uo(Vo(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:Uo(e.Token)};if(void 0!==e.Ref)return{Ref:Uo(e.Ref)}}return{Token:Uo(t)}},Fo=t=>{const e=t.tolerance??{};return{assetDecimals:Lo(t.asset_decimals),maxPriceStaleSeconds:Lo(t.max_price_stale_seconds),sources:Go(t.sources).map((t=>t)),tolerance:{upperRatio:Lo(e.upper_ratio_bps),lowerRatio:Lo(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:Co(t.min_sanity_price_wad),maxSanityPriceWad:Co(t.max_sanity_price_wad)}},Ho={"market:create":t=>({topic:"market:create",data:{hubId:Lo(t.hub_id),baseAsset:Uo(t.base_asset),maxBorrowRate:Co(t.max_borrow_rate),baseBorrowRate:Co(t.base_borrow_rate),slope1:Co(t.slope1),slope2:Co(t.slope2),slope3:Co(t.slope3),midUtilization:Co(t.mid_utilization),optimalUtilization:Co(t.optimal_utilization),maxUtilization:Co(t.max_utilization),reserveFactor:Lo(t.reserve_factor),marketAddress:Uo(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Uo(t.asset),maxBorrowRateRay:Co(t.max_borrow_rate),baseBorrowRateRay:Co(t.base_borrow_rate),slope1Ray:Co(t.slope1),slope2Ray:Co(t.slope2),slope3Ray:Co(t.slope3),midUtilizationRay:Co(t.mid_utilization),optimalUtilizationRay:Co(t.optimal_utilization),maxUtilizationRay:Co(t.max_utilization),reserveFactorBps:Lo(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Go(t).map((t=>{return e=Go(t),{hubId:Lo(e[0]),asset:Uo(e[1]),timestamp:Lo(e[2]),supplyIndexRay:Co(e[3]),borrowIndexRay:Co(e[4]),cash:Co(e[5]),suppliedRay:Co(e[6]),borrowedRay:Co(e[7]),revenueRay:Co(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Go(t).map((t=>{const e=t;return{hubId:Lo(e.hub_id),asset:Uo(e.asset),params:(o=e.params,{maxBorrowRateRay:Co(o.max_borrow_rate),baseBorrowRateRay:Co(o.base_borrow_rate),slope1Ray:Co(o.slope1),slope2Ray:Co(o.slope2),slope3Ray:Co(o.slope3),midUtilizationRay:Co(o.mid_utilization),optimalUtilizationRay:Co(o.optimal_utilization),maxUtilizationRay:Co(o.max_utilization),reserveFactorBps:Lo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:Lo(o.flashloan_fee),assetId:Uo(o.asset_id),assetDecimals:Lo(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=Go(t);return{topic:"position:batch_update",data:{accountId:Co(e[0]),accountAttributes:Wo(Go(e[1])),updates:[...Go(e[2]).map((t=>zo(Go(t),"Deposit"))),...Go(e[3]).map((t=>zo(Go(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:Lo(t.hub_id),asset:Uo(t.asset),receiver:Uo(t.receiver),caller:Uo(t.caller),amount:Co(t.amount),fee:Co(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:jo(t.key),oracle:Fo(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Uo(t.asset),oracle:Fo(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:Uo(t.liquidator),accountId:Co(t.account_id),repaidUsdWad:Co(t.repaid_usd_wad),bonusBps:Co(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Co(t.account_id),totalBorrowUsdWad:Co(t.total_borrow_usd_wad),totalCollateralUsdWad:Co(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Uo(t.token),amount:Co(t.amount),usdValueWad:Co(t.usd_value_wad),accountId:Co(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Lo(t.hub_id),asset:Uo(t.asset),amount:Co(t.amount),fee:Co(t.fee),amountSent:Co(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:Uo(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:No(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:Uo(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:Uo(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Uo(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Uo(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:No(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Lo(t.max_supply_positions),maxBorrowPositions:Lo(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Co(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Uo(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:Lo(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:Co(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Co(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Lo(e.liquidation_bonus_factor_bps)}}}},Xo=Object.freeze(Object.keys(Ho));function Zo(t,e){const o=$o(t),r=Ho[o];return r?r(i(Oo(e))):null}const Ko=1e4;function Qo(t,e){return`${t}-${BigInt(e).toString(10)}`}function Jo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function Yo(t,e=0){return t*Ko+e}function tr(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const er=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},or=t=>t.baseUrl??f[t.network];async function rr(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=er(or(e),"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function nr(t){const e=er(or(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const ur=t=>D(t).toXDR("base64");function ir(e,n){const i=e.routerAddress??b(e.network),s=new r(i),a=new t(e.caller,e.sourceSequence),p=V(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new u(a,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(s.call("execute_strategy",q(e.caller),T(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function sr(t,e){return ir(t,e)}function ar(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(cr),splitPpm:t.splitPpm}))):[{hops:t.hops.map(cr),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function pr(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:ar(t,e)}const lr=ar,cr=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function dr(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function yr(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw dr(o.invokedContractId,t);throw t}}async function gr(t,e,o){return yr(t,e.xdr,o)}function fr(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function mr(t,e){return new Uint8Array(0)}const hr=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function br(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(hr(e.message)),s.ScVal.scvBytes(hr(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:m[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Sr={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."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},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 xr(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const o=Number(e[1]),r=Sr[o];return r?{code:o,...r}:null}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var o=p[t]={exports:{}};return a[t](o,o.exports,l),o.exports}l.d=(t,e)=>{for(var o in e)l.o(e,o)&&!l.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="https://api.xoxno.com",d="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",y="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",g="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var f;!function(t){t.MAINNET="1",t.DEVNET="D"}(f||(f={}));class m{apiUrl;chain;init;config;constructor({chain:t=f.MAINNET,apiUrl:e=c,...o}={}){this.apiUrl=e??{[f.MAINNET]:c,[f.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==f.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:s,cache:a,debug:p,headers:l,method:c="GET",...d}=o,y=l?.Authorization,g="Bearer undefined"===y?void 0:y,f={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===c?{}:{"Content-Type":"application/json"},...g?{Authorization:g}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),h=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:b,...S}=r??{},{revalidate:x,...v}=s??{},w="GET"!==c||g?void 0:x??b,q="GET"!==c||g||w?void 0:a??n,T={...i,...d,method:c,...Object.keys(f).length?{headers:f}:{},cache:q,next:{...S,...v,revalidate:w}};(p??u)&&console.debug("SDK fetch: ",h,T);const _=await fetch(h,T).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${h}: ${t.message}`),{cause:t});throw t})),A=await _.text();if(!_.ok){let t;try{t=JSON.parse(A)}catch{t={message:A}}const e=[h,_.status,_.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(A)}catch{return A}}}const h=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),r=/^C[A-Z2-7]{55}$/.test(t);return e||o||r},b=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t),r=/^C[A-Z2-7]{55}-\d+$/.test(t);return e||o||r};class S extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class x extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^[GC][A-Z2-7]{55}$/.test(t)),w={"/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/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{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:{}}}},q=["PATCH","POST","DELETE","PUT"];var T=l(385);const _=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function A(t,e,o,r){const{input:n,output:u,...i}=e,s=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!v(t))throw new x(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!h(t))):!h(t))throw new S(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:y,headers:g,cache:f,next:m,debug:b,continuationToken:w,...q}=l,T=d?`Bearer ${d}`:void 0,_={...g,...T?{Authorization:T}:{},...w?{"X-Continuation-Token":String(w)}:{}},A={...m,tags:[...m?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:q,body:c,headers:_,cache:f,debug:b,...A?{next:A}:{}})},a=(t={})=>s(t);for(const t of Object.keys(i))q.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(w)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=_(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=_(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let s;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];s=A(o,n,r,t)}else{s={};for(const{rawPath:o,def:n}of e.leaves)s[_(o.split("/").pop().replace(/^:/,""))]=A(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===s[t]?s[t]=u:"function"==typeof s[t]?Object.assign(s[t],u):"function"==typeof u?(Object.assign(u,s[t]),s[t]=u):Object.assign(s[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(s[t]){const o=s[t];s[t]=t=>({...o(t),...e(t)})}else s[t]=e}return s};return o(e,{})}export{f as Chain,m as XOXNOClient,k as buildSdk,h as isValidCollectionTicker,b as isValidNftIdentifier};export const STELLAR_AGGREGATOR_ROUTER=T.ME;export const STELLAR_GOVERNANCE=T.nO;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=T.G_;export const STELLAR_LENDING_CONTROLLER=T.DU;export const STELLAR_LENDING_TOPICS=T.fA;export const STELLAR_NETWORK_PASSPHRASE=T.A$;export const STELLAR_QUOTE_URL=T.J9;export const STELLAR_SOROBAN_RPC_URL=T.hS;export const SYNTHETIC_EVENT_ORDER_STRIDE=T.gR;export const buildSameTokenRepaySwapSteps=T.VZ;export const buildStellarAcceptOwnershipTx=T.N0;export const buildStellarAddRewardsTx=T.B_;export const buildStellarApproveBlendPoolTx=T.qL;export const buildStellarApproveTokenTx=T.eX;export const buildStellarBatchSwapTx=T.z;export const buildStellarBorrowBatchTx=T.xD;export const buildStellarBorrowTx=T.jR;export const buildStellarCctpForwardTx=T.P2;export const buildStellarClaimRevenueTx=T.W6;export const buildStellarCreateLiquidityPoolTx=T.se;export const buildStellarExecuteCancellerResetTx=T.ZP;export const buildStellarExecuteStrategyTx=T.yr;export const buildStellarFlashLoanTx=T.sp;export const buildStellarGovernanceAddSpokeImmediateTx=T.Iu;export const buildStellarGovernanceCreateHubImmediateTx=T.yu;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=T.$9;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=T.zw;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=T.h_;export const buildStellarGovernanceExecuteTransferGovOwnTx=T.e_;export const buildStellarGovernanceExecuteTx=T.Tk;export const buildStellarGovernanceExecuteUpdateDelayTx=T.BA;export const buildStellarGovernancePauseTx=T.u9;export const buildStellarGovernanceRevokeRoleImmediateTx=T.bi;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=T.gc;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=T.ay;export const buildStellarGrantRoleTx=T.SX;export const buildStellarLendingIdentifier=T.UF;export const buildStellarLiquidateTx=T.Y5;export const buildStellarMigrateFromBlendTx=T.mE;export const buildStellarMigrateTx=T.xG;export const buildStellarMultiplyTx=T.s9;export const buildStellarPauseTx=T.OL;export const buildStellarProposeAddAssetToSpokeTx=T.k6;export const buildStellarProposeAddSpokeTx=T.dj;export const buildStellarProposeApproveBlendPoolTx=T.kD;export const buildStellarProposeApproveTokenTx=T.Yf;export const buildStellarProposeCancellerResetTx=T.AI;export const buildStellarProposeConfigureAssetOracleTx=T.O2;export const buildStellarProposeConfigureMarketOracleTx=T.c5;export const buildStellarProposeCreateHubTx=T.N8;export const buildStellarProposeCreateLiquidityPoolTx=T.qU;export const buildStellarProposeDeployPoolTx=T.RZ;export const buildStellarProposeEditAssetInSpokeTx=T.ni;export const buildStellarProposeEditOracleToleranceTx=T.hF;export const buildStellarProposeGovernanceUpgradeTx=T.Qk;export const buildStellarProposeGrantGovernanceRoleTx=T.Gw;export const buildStellarProposeMigrateControllerTx=T.$K;export const buildStellarProposeRemoveAssetFromSpokeTx=T.uj;export const buildStellarProposeRemoveSpokeTx=T.Od;export const buildStellarProposeRevokeBlendPoolTx=T.X7;export const buildStellarProposeRevokeGovernanceRoleTx=T.Ub;export const buildStellarProposeRevokeTokenTx=T.Dx;export const buildStellarProposeSetAccumulatorTx=T.OA;export const buildStellarProposeSetAggregatorTx=T.$U;export const buildStellarProposeSetMinBorrowCollatTx=T.ob;export const buildStellarProposeSetPositionLimitsTx=T.$l;export const buildStellarProposeSetPositionManagerTx=T.K;export const buildStellarProposeSetPriceAggregatorTx=T.Wb;export const buildStellarProposeSetSpokeLiquidationCurveTx=T.kw;export const buildStellarProposeSetSwapAggregatorTx=T.qA;export const buildStellarProposeTransferCtrlOwnershipTx=T.VS;export const buildStellarProposeTransferGovOwnTx=T.HP;export const buildStellarProposeUnpauseTx=T.xQ;export const buildStellarProposeUpdateDelayTx=T.YQ;export const buildStellarProposeUpgradeControllerTx=T.QY;export const buildStellarProposeUpgradePoolParamsTx=T.os;export const buildStellarProposeUpgradePoolTx=T.Ko;export const buildStellarRenewAccountTx=T.IJ;export const buildStellarRepayBatchTx=T.nw;export const buildStellarRepayDebtWithCollateralTx=T.Pr;export const buildStellarRepayTx=T.ZE;export const buildStellarRevokeBlendPoolTx=T.X0;export const buildStellarRevokeRoleTx=T.ev;export const buildStellarRevokeTokenTx=T.P8;export const buildStellarSetAccumulatorTx=T.aV;export const buildStellarSetAggregatorTx=T.p2;export const buildStellarSetMarketOracleConfigTx=T.sV;export const buildStellarSetOracleSanityBoundsTx=T.XD;export const buildStellarSetOracleToleranceTx=T.Js;export const buildStellarSetOracleTx=T.W5;export const buildStellarSetPositionLimitsTx=T.Dy;export const buildStellarSetPriceAggregatorTx=T._i;export const buildStellarSetSpokeAssetFlagsTx=T.FZ;export const buildStellarSetSwapAggregatorTx=T.wG;export const buildStellarSupplyBatchTx=T.Ni;export const buildStellarSupplyTx=T.v_;export const buildStellarSwapCollateralTx=T.qD;export const buildStellarSwapDebtTx=T.qR;export const buildStellarTransferOwnershipTx=T.QJ;export const buildStellarUnpauseTx=T.bm;export const buildStellarUpdateAccountThresholdTx=T.n_;export const buildStellarUpdateIndexesTx=T.v8;export const buildStellarUpgradeControllerTx=T.qM;export const buildStellarUpgradeLiquidityPoolParamsTx=T.gH;export const buildStellarWithdrawBatchTx=T.O3;export const buildStellarWithdrawTx=T.Gz;export const buildTx=T.pr;export const decodeStellarLendingEvent=T.Fm;export const decodeStellarLiquidateReturn=T.OB;export const encodeAssetOracle=T.Ft;export const encodeInterestRateModel=T.MB;export const encodeMarketOracleConfigInput=T.Dn;export const encodeMarketParamsRaw=T.pq;export const encodePositionLimits=T.Q3;export const encodePriceKey=T.Jh;export const encodeStrategyPayloadToRouteXdr=T.wf;export const extractEventOrder=T.Um;export const getStellarAccountDelegates=T.XR;export const getStellarAccountPositions=T.xO;export const getStellarAggregatorQuote=T.Lw;export const getStellarAggregatorRouter=T.KM;export const getStellarAsset=T.mM;export const getStellarAssetGraph=T.iE;export const getStellarAssetMarkets=T.zp;export const getStellarAssetPage=T.N3;export const getStellarAssets=T.bN;export const getStellarBlendPools=T.cK;export const getStellarContractConfig=T.kV;export const getStellarContractRoles=T.vo;export const getStellarGovernance=T.QV;export const getStellarGovernanceProposals=T.T_;export const getStellarHub=T.XI;export const getStellarHubGraph=T.Lt;export const getStellarHubs=T.KK;export const getStellarLendingContext=T.yl;export const getStellarLendingController=T.vc;export const getStellarLendingLiveState=T.kq;export const getStellarProtocolConfig=T.Mi;export const getStellarQuoteTokens=T.CH;export const getStellarReserve=T.FI;export const getStellarReserveGraph=T.KG;export const getStellarReserveHolders=T.nW;export const getStellarReserves=T.jF;export const getStellarSpoke=T.S2;export const getStellarSpokeGraph=T.uS;export const getStellarSpokes=T.u_;export const getStellarUserActivity=T.O5;export const getStellarUserPositions=T.Av;export const mapQuoteResponseToAggregatorSwap=T.LA;export const mapQuoteResponseToStrategyPayload=T.E6;export const mapQuoteResponseToStrategySwap=T.Ds;export const mapSorobanError=T.XV;export const mapStellarPositionActivityType=T.CU;export const prepareStellarBuiltTx=T.Vx;export const prepareStellarTxXdr=T.DL;export const stellarLendingDispatchKey=T.ON;export const stellarLendingRead=T.Hh;export const syntheticEventOrder=T.oV;export const tagStellarInvokedContractError=T.g5;export const toBase64Xdr=T.L;export const toStellarPositionMode=T.Vu;
@@ -2152,7 +2152,7 @@ export declare const endpoints: {
2152
2152
  };
2153
2153
  readonly "/user/blend/:address": {
2154
2154
  readonly input: {};
2155
- readonly output: BlendUserPosition;
2155
+ readonly output: BlendUserPosition[];
2156
2156
  };
2157
2157
  readonly "/stellar/aggregator/quote": {
2158
2158
  readonly input: {
@@ -0,0 +1,2 @@
1
+ /** Pins the identifier shapes the SDK accepts, per chain. */
2
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "1.0.209",
3
+ "version": "1.0.211",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {