@xoxno/sdk-js 1.0.207 → 1.0.210

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
@@ -845,6 +845,12 @@ sdk.stellarLending.stats.history(...); // StellarStatsHistoryDto
845
845
  // GET /stellar-lending/pnl
846
846
  sdk.stellarLending.pnl(...); // StellarPositionsPnlDto
847
847
 
848
+ // GET /stellar-lending/campaign/leaderboard
849
+ sdk.stellarLending.campaign.leaderboard(...); // StellarCampaignLeaderboardDto
850
+
851
+ // GET /stellar-lending/campaign/me
852
+ sdk.stellarLending.campaign.me(...); // StellarCampaignMeDto
853
+
848
854
  // GET /stellar-lending/positions
849
855
  sdk.stellarLending.positions(...); // StellarPositionsRankDto
850
856
 
@@ -6,8 +6,6 @@
6
6
  * inlined rather than imported since `@xoxno/types` does not re-export its enums
7
7
  * on its top-level type surface.
8
8
  */
9
- /** Synthetic NFT collection ticker for Stellar lending accounts. */
10
- export declare const XOXNO_LENDING_STELLAR_TICKER = "XLENDXLM-a7c9f3";
11
9
  /**
12
10
  * A child delta's contribution to `eventOrder`: `base * STRIDE + childIndex`.
13
11
  * The stride bounds the number of child deltas per base event before two base
@@ -17,11 +15,13 @@ export declare const SYNTHETIC_EVENT_ORDER_STRIDE = 10000;
17
15
  /** `XoxnoLendingActivity` values used by the position activity mapping. */
18
16
  export type StellarLendingActivityType = 'lendingUpdateAccountPosition' | 'lendingLiquidateRepayDebt' | 'lendingLiquidateSeizeCollateral' | 'lendingUpdateAccountParameters';
19
17
  /**
20
- * Synthetic NFT identifier for a Stellar lending account, e.g.
21
- * `XLENDXLM-a7c9f3-2a` for account 42. The u64 account id is rendered as
22
- * even-length lowercase hex.
18
+ * NFT identifier for a Stellar lending account: the position-NFT contract
19
+ * address with the decimal account id (== token id) appended, e.g.
20
+ * `CDVN5…LPSY-42`. The account IS an on-chain NFT since the NFT-ownership
21
+ * protocol; the collection is the contract itself and there is no synthetic
22
+ * ticker or hex encoding anymore.
23
23
  */
24
- export declare function buildStellarLendingIdentifier(accountId: string): string;
24
+ export declare function buildStellarLendingIdentifier(positionNftContract: string, accountId: string): string;
25
25
  /**
26
26
  * Extract the base event order from a Soroban RPC event id (`<ledger>-<index>`).
27
27
  * Returns 0 when the id is malformed or has no index segment.
@@ -1,4 +1,4 @@
1
- import type { PublicOnly, RateType, LoginAccessDto, LoginRequestDto, UserNetworkInfoDto, UserTokenInventoryResponseDto, UserProfileDoc, UserProfileEditDto, UserProfileDto, UserSettingsDoc, NotificationPreferencesPostDto, SetEmailDto, SetPhoneDto, UserBillingDetails, VerifyEmailDto, TradesilvaniaSignature, SuccessDto, CreatorProfileDto, CreatorProfileDoc, CreatorProfileEditDto, CollectionStatsFilter, CollectionStatsPaginated, CheckLikeStatusResponseDto, UserFavoriteResponseDto, TokenDataDocHydrated, XoxnoInfo, XoxnoLiquidStatsDto, AnalyticsMarketplaceUniqueUsers, ProtocolAprType, ProviderDto, DelegationDataOutput, LendingMarketProfile, LendingMarketProfileFilter, LendingMarketProfileQuery, LendingGovernanceProposalFilter, LendingGovernanceProposalQuery, LendingGovernanceProposalDoc, LendingAccountProfile, LendingIndexesDto, LendingAccountPnl, LendingAccountSummary, LendingEModeCategoryProfile, LendingMarketAnalyticsGraph, LendingStatsHistory, LendingMarketAverageGraph, LendingPositionStatus, LendingOverallStats, DefillamaLendingExport, DefillamaLendingHistoryExport, DefillamaLendingRevenueExport, StellarLendingUserStatsExport, NftDocFilter, NftPaginated, LikeNftDto, InventorySummaryDtoHydrated, NftOfferPaginated, NftOfferDocFilter, NftOfferDocHydrated, ValueFp, TraitInfo, CollectionRanksDTO, ListingsResponseDto, NftDocHydrated, SignDataDto, SignWithdrawDto, SignAcceptGlobalOfferDto, SignMintDto, NftDocFull, CollectionProfileDoc, CollectionProfileEditDto, FloorPriceDto, PinnedCollectionDto, CollectionMintProfileDocHydrated, CollectionPinnedStatusDto, FollowCollectionDto, CollectionProfileFilter, CollectionProfilePaginated, CollectionMintProfileFilter, CollectionMintProfilePaginated, CollectionMintProfileDocWithStages, CollectionHoldersDto, CollectionHoldersExportDto, CollectionOwnerDto, CollectionStatsDocHydrated, CollectionOffersFilter, GlobalOfferPaginated, CreatorDetailsDto, ShareholderDto, StakingSummary, StakingPoolDoc, StakingEditDto, OwnedCollectionsDto, UserStakingSummaryDto, StakingCreatorDoc, StakingUserPoolNfts, StakingExploreDtoHydrated, OwnedServicesDto, FilterQueryDto, GlobalSearchResourcesPaginated, LendingNftAttributes, LendingTokenPriceDto, StellarAssetListItemDto, StellarLendingContextDto, StellarLendingLiveStateDto, StellarDetailedMarketDto, StellarHubListItemDto, StellarSpokeListItemDto, StellarReserveListItemDto, ReserveDto, TopHoldersDto, AssetDto, AssetPageDto, AssetMarketDto, HubDto, SpokeDto, AccountPositionsDto, StellarUserActivityItemDto, GovernanceProposalsPageDto, MarketGraphDto, SpokeGraphDto, StellarStatsHistoryDto, StellarPositionsPnlDto, StellarPositionsRankDto, UserHistoryDto, PnlByScopeDto, RevenueSeriesDto, FeeRevenueSeriesDto, ParticipantCountsDto, LiquidationsSeriesDto, LiquidationsLeaderboardDto, VolumeSeriesDto, ActiveUsersSeriesDto, HolderDistributionDto, RateSpreadSeriesDto, DefiLlamaDimensionsDto, NotificationPaginated, PushNotificationCountResponse, NotificationDoc, MobileDeviceDoc, MobileDeviceRegistrationDto, PushNotificationResponse, PushNotificationDoc, NotificationSuccessResponseDto, EventNotificationDto, CreatorMarketingNotificationDto, StellarChallengeResponseDto, Web2UserDoc, SuccessWithMessageDto, NativeWalletDto, SwitchWalletDto, Web2WalletDto, Web2UserShardsDto, NftActivityFilter, NftActivityPaginated, NftActivityDocHydrated, VolumeGraph, AnalyticsVolumeDto, UserAnalyticsDto, GlobalAnalyticsOverviewResponseDto, UserStatsDto, AirdropDtoHydrated, TransactionDetailed, TransactionProcessStatus, TransactionCostData, TransactionCreate, TransactionSendResult, ChatMessageDocHydrated, SendChatMessageDto, UserConversationPaginated, ChatMessagePaginated, GlobalConversationSummaryDto, UserBlockPaginated, WebSocketTokenDto, UserInfo, EventProfile, EventProfileCreateDto, EventProfileEditDto, EventProfileFilter, EventProfileQuery, EventRegistrationResponseDto, EventGuestRegistrationDto, EventTicketProfileDoc, EventTicketProfileCreateDto, EventTicketProfileEditDto, EventStageProfileDoc, EventStageProfileCreateDto, EventStageProfileEditDto, TicketPricesResponse, TicketCalculationRequestDto, DiscountCodeValidationResponse, EventInvitationDoc, EventInvitationCreateDto, EventInvitationFilter, EventInvitationQuery, EventInvitation, EventAcceptInvitation, EventClaimInvitationDto, EventVoucherFilter, EventVoucherQuery, EventQuestionDoc, EventQuestionCreateDto, EventQuestionEditDto, EventGuestFilter, EventGuestProfileQuery, EventGuestProfile, EventGuestExport, EventUserRole, EventUserRoleCreateDto, EventUserRoleEditDto, EventUserRoleDoc, BageQRData, TicketValidationResult, EventCheckInQR, EventVoucherDoc, EventVoucherCreateDto, EventVoucherEditDto, ManualCheckInDto, AnsweredQuestionWithDetails, EventGuestApproveDto, EventCountGroupedByCountry, EventReferralConfigDoc, EventReferralConfigCreateDto, EventReferralConfigEditDto, EventReferralConfigFilter, EventReferralConfigPaginated, EventReferralDoc, EventReferralCreateDto, EventReferralEditDto, EventReferralFilter, EventReferralPaginated, BlendUserPosition, SoroswapQuoteResponseDto, PerpOrderResponse, BarDto, SymbolInfoDto, PerpCoinExtended, PerpSpotCoinExtended, PerpCoinExtendedSlim, PerpLegalCheck, PerpSpotCoinExtendedSlim, L2BookPerpResponseSingle, TradesPerpResponseSingle, ActiveSpotAssetCtx, ActivePerpAssetCtx, PerpEvent } from '@xoxno/types';
1
+ import type { PublicOnly, RateType, LoginAccessDto, LoginRequestDto, UserNetworkInfoDto, UserTokenInventoryResponseDto, UserProfileDoc, UserProfileEditDto, UserProfileDto, UserSettingsDoc, NotificationPreferencesPostDto, SetEmailDto, SetPhoneDto, UserBillingDetails, VerifyEmailDto, TradesilvaniaSignature, SuccessDto, CreatorProfileDto, CreatorProfileDoc, CreatorProfileEditDto, CollectionStatsFilter, CollectionStatsPaginated, CheckLikeStatusResponseDto, UserFavoriteResponseDto, TokenDataDocHydrated, XoxnoInfo, XoxnoLiquidStatsDto, AnalyticsMarketplaceUniqueUsers, ProtocolAprType, ProviderDto, DelegationDataOutput, LendingMarketProfile, LendingMarketProfileFilter, LendingMarketProfileQuery, LendingGovernanceProposalFilter, LendingGovernanceProposalQuery, LendingGovernanceProposalDoc, LendingAccountProfile, LendingIndexesDto, LendingAccountPnl, LendingAccountSummary, LendingEModeCategoryProfile, LendingMarketAnalyticsGraph, LendingStatsHistory, LendingMarketAverageGraph, LendingPositionStatus, LendingOverallStats, DefillamaLendingExport, DefillamaLendingHistoryExport, DefillamaLendingRevenueExport, StellarLendingUserStatsExport, NftDocFilter, NftPaginated, LikeNftDto, InventorySummaryDtoHydrated, NftOfferPaginated, NftOfferDocFilter, NftOfferDocHydrated, ValueFp, TraitInfo, CollectionRanksDTO, ListingsResponseDto, NftDocHydrated, SignDataDto, SignWithdrawDto, SignAcceptGlobalOfferDto, SignMintDto, NftDocFull, CollectionProfileDoc, CollectionProfileEditDto, FloorPriceDto, PinnedCollectionDto, CollectionMintProfileDocHydrated, CollectionPinnedStatusDto, FollowCollectionDto, CollectionProfileFilter, CollectionProfilePaginated, CollectionMintProfileFilter, CollectionMintProfilePaginated, CollectionMintProfileDocWithStages, CollectionHoldersDto, CollectionHoldersExportDto, CollectionOwnerDto, CollectionStatsDocHydrated, CollectionOffersFilter, GlobalOfferPaginated, CreatorDetailsDto, ShareholderDto, StakingSummary, StakingPoolDoc, StakingEditDto, OwnedCollectionsDto, UserStakingSummaryDto, StakingCreatorDoc, StakingUserPoolNfts, StakingExploreDtoHydrated, OwnedServicesDto, FilterQueryDto, GlobalSearchResourcesPaginated, LendingNftAttributes, LendingTokenPriceDto, StellarAssetListItemDto, StellarLendingContextDto, StellarLendingLiveStateDto, StellarDetailedMarketDto, StellarHubListItemDto, StellarSpokeListItemDto, StellarReserveListItemDto, ReserveDto, TopHoldersDto, AssetDto, AssetPageDto, AssetMarketDto, HubDto, SpokeDto, AccountPositionsDto, StellarUserActivityItemDto, GovernanceProposalsPageDto, MarketGraphDto, SpokeGraphDto, StellarStatsHistoryDto, StellarPositionsPnlDto, StellarCampaignLeaderboardDto, StellarCampaignMeDto, StellarPositionsRankDto, UserHistoryDto, PnlByScopeDto, RevenueSeriesDto, FeeRevenueSeriesDto, ParticipantCountsDto, LiquidationsSeriesDto, LiquidationsLeaderboardDto, VolumeSeriesDto, ActiveUsersSeriesDto, HolderDistributionDto, RateSpreadSeriesDto, DefiLlamaDimensionsDto, NotificationPaginated, PushNotificationCountResponse, NotificationDoc, MobileDeviceDoc, MobileDeviceRegistrationDto, PushNotificationResponse, PushNotificationDoc, NotificationSuccessResponseDto, EventNotificationDto, CreatorMarketingNotificationDto, StellarChallengeResponseDto, Web2UserDoc, SuccessWithMessageDto, NativeWalletDto, SwitchWalletDto, Web2WalletDto, Web2UserShardsDto, NftActivityFilter, NftActivityPaginated, NftActivityDocHydrated, VolumeGraph, AnalyticsVolumeDto, UserAnalyticsDto, GlobalAnalyticsOverviewResponseDto, UserStatsDto, AirdropDtoHydrated, TransactionDetailed, TransactionProcessStatus, TransactionCostData, TransactionCreate, TransactionSendResult, ChatMessageDocHydrated, SendChatMessageDto, UserConversationPaginated, ChatMessagePaginated, GlobalConversationSummaryDto, UserBlockPaginated, WebSocketTokenDto, UserInfo, EventProfile, EventProfileCreateDto, EventProfileEditDto, EventProfileFilter, EventProfileQuery, EventRegistrationResponseDto, EventGuestRegistrationDto, EventTicketProfileDoc, EventTicketProfileCreateDto, EventTicketProfileEditDto, EventStageProfileDoc, EventStageProfileCreateDto, EventStageProfileEditDto, TicketPricesResponse, TicketCalculationRequestDto, DiscountCodeValidationResponse, EventInvitationDoc, EventInvitationCreateDto, EventInvitationFilter, EventInvitationQuery, EventInvitation, EventAcceptInvitation, EventClaimInvitationDto, EventVoucherFilter, EventVoucherQuery, EventQuestionDoc, EventQuestionCreateDto, EventQuestionEditDto, EventGuestFilter, EventGuestProfileQuery, EventGuestProfile, EventGuestExport, EventUserRole, EventUserRoleCreateDto, EventUserRoleEditDto, EventUserRoleDoc, BageQRData, TicketValidationResult, EventCheckInQR, EventVoucherDoc, EventVoucherCreateDto, EventVoucherEditDto, ManualCheckInDto, AnsweredQuestionWithDetails, EventGuestApproveDto, EventCountGroupedByCountry, EventReferralConfigDoc, EventReferralConfigCreateDto, EventReferralConfigEditDto, EventReferralConfigFilter, EventReferralConfigPaginated, EventReferralDoc, EventReferralCreateDto, EventReferralEditDto, EventReferralFilter, EventReferralPaginated, BlendUserPosition, SoroswapQuoteResponseDto, PerpOrderResponse, BarDto, SymbolInfoDto, PerpCoinExtended, PerpSpotCoinExtended, PerpCoinExtendedSlim, PerpLegalCheck, PerpSpotCoinExtendedSlim, L2BookPerpResponseSingle, TradesPerpResponseSingle, ActiveSpotAssetCtx, ActivePerpAssetCtx, PerpEvent } from '@xoxno/types';
2
2
  import type { ActivityChain, TokenCategory, LendingPositionOrderByColumn, KustoOrderDirection, OfferType, StakingStatus, UserStatsOrderByColumn } from '@xoxno/types/enums';
3
3
  export declare const endpoints: {
4
4
  readonly "/liquid/xoxno/rate": {
@@ -1085,6 +1085,19 @@ export declare const endpoints: {
1085
1085
  };
1086
1086
  readonly output: StellarPositionsPnlDto;
1087
1087
  };
1088
+ readonly "/stellar-lending/campaign/leaderboard": {
1089
+ readonly input: {
1090
+ skip?: number;
1091
+ top?: number;
1092
+ };
1093
+ readonly output: StellarCampaignLeaderboardDto;
1094
+ };
1095
+ readonly "/stellar-lending/campaign/me": {
1096
+ readonly input: {
1097
+ owner: string;
1098
+ };
1099
+ readonly output: StellarCampaignMeDto;
1100
+ };
1088
1101
  readonly "/stellar-lending/positions": {
1089
1102
  readonly input: {
1090
1103
  token?: string;
@@ -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:()=>zr,XOXNO_LENDING_STELLAR_TICKER:()=>Wr,buildSameTokenRepaySwapSteps:()=>so,buildStellarAcceptOwnershipTx:()=>Je,buildStellarAddRewardsTx:()=>ft,buildStellarApproveBlendPoolTx:()=>nt,buildStellarApproveTokenTx:()=>at,buildStellarBatchSwapTx:()=>eo,buildStellarBorrowBatchTx:()=>W,buildStellarBorrowTx:()=>z,buildStellarCctpForwardTx:()=>co,buildStellarClaimRevenueTx:()=>mt,buildStellarCreateLiquidityPoolTx:()=>bt,buildStellarExecuteCancellerResetTx:()=>yr,buildStellarExecuteStrategyTx:()=>Yr,buildStellarFlashLoanTx:()=>K,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:()=>Hr,buildStellarLiquidateTx:()=>X,buildStellarMigrateFromBlendTx:()=>Z,buildStellarMigrateTx:()=>je,buildStellarMultiplyTx:()=>J,buildStellarPauseTx:()=>Ve,buildStellarProposeAddAssetToSpokeTx:()=>Nt,buildStellarProposeAddSpokeTx:()=>Ct,buildStellarProposeApproveBlendPoolTx:()=>Ft,buildStellarProposeApproveTokenTx:()=>zt,buildStellarProposeCancellerResetTx:()=>br,buildStellarProposeConfigureAssetOracleTx:()=>er,buildStellarProposeConfigureMarketOracleTx:()=>tr,buildStellarProposeCreateHubTx:()=>Lt,buildStellarProposeCreateLiquidityPoolTx:()=>Vt,buildStellarProposeDeployPoolTx:()=>Qt,buildStellarProposeEditAssetInSpokeTx:()=>Ut,buildStellarProposeEditOracleToleranceTx:()=>rr,buildStellarProposeGovernanceUpgradeTx:()=>or,buildStellarProposeGrantGovernanceRoleTx:()=>ur,buildStellarProposeMigrateControllerTx:()=>Jt,buildStellarProposeRemoveAssetFromSpokeTx:()=>Gt,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:()=>Zt,buildStellarProposeUpgradePoolParamsTx:()=>Xt,buildStellarProposeUpgradePoolTx:()=>Kt,buildStellarRenewAccountTx:()=>gt,buildStellarRepayBatchTx:()=>j,buildStellarRepayDebtWithCollateralTx:()=>te,buildStellarRepayTx:()=>V,buildStellarRevokeBlendPoolTx:()=>ut,buildStellarRevokeRoleTx:()=>Ke,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:()=>Ze,buildStellarUnpauseTx:()=>Xe,buildStellarUpdateAccountThresholdTx:()=>ht,buildStellarUpdateIndexesTx:()=>St,buildStellarUpgradeControllerTx:()=>Fe,buildStellarUpgradeLiquidityPoolParamsTx:()=>yt,buildStellarWithdrawBatchTx:()=>H,buildStellarWithdrawTx:()=>F,buildTx:()=>G,decodeStellarLendingEvent:()=>Dr,decodeStellarLiquidateReturn:()=>Q,encodeAssetOracle:()=>ze,encodeInterestRateModel:()=>Oe,encodeMarketOracleConfigInput:()=>He,encodeMarketParamsRaw:()=>Me,encodePositionLimits:()=>Le,encodePriceKey:()=>Ce,encodeStrategyPayloadToRouteXdr:()=>Jr,extractEventOrder:()=>Fr,getStellarAccountDelegates:()=>Re,getStellarAccountPositions:()=>Te,getStellarAggregatorQuote:()=>Kr,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:()=>oo,mapQuoteResponseToStrategyPayload:()=>to,mapQuoteResponseToStrategySwap:()=>ro,mapSorobanError:()=>go,mapStellarPositionActivityType:()=>Vr,prepareStellarBuiltTx:()=>io,prepareStellarTxXdr:()=>ao,stellarLendingDispatchKey:()=>_r,stellarLendingRead:()=>Ie,syntheticEventOrder:()=>jr,tagStellarInvokedContractError:()=>uo,toBase64Xdr:()=>Ar,toStellarPositionMode:()=>lo});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))})},L=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)},C=()=>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},N=e=>{if("string"==typeof e)return L(B(e));if(e instanceof Uint8Array)return 0===e.length?C():L(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?L(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?L(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?L(B(e.bytes)):0===e.bytes.length?C():L(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)")},U=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 G(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 G(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 G(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 G(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 G(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 G(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 K(e,t){return G(e,"flash_loan",[y(e.caller),P(t.hubId,t.asset),m(t.amount),y(t.receiver),U(t.data)])}function Z(e,t){return G(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 G(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),N(t.steps),_(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),_(t.convertSwap,N)])}function Y(e,t){return G(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),N(t.steps)])}function ee(e,t){return G(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),N(t.steps)])}function te(e,t){return G(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),N(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)}),Le=e=>I({max_borrow_positions:f(e.maxBorrowPositions),max_supply_positions:f(e.maxSupplyPositions)}),Ce=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)}`)},Ne=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)}`)},Ue=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Ge=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:Ne(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:Ue(t.kind),nature:Ge(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:Ue(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:Ce(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return A([x("LpShare"),I({key_a:Ce(t.keyA),key_b:Ce(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 G(e,"upgrade",[q(t.wasmHash)])}function je(e,t){return G(e,"migrate",[f(t.newVersion)])}function Ve(e){return G(e,"pause",[])}function Xe(e){return G(e,"unpause",[])}function Qe(e,t){return G(e,"grant_role",[y(t.account),x(t.role)])}function Ke(e,t){return G(e,"revoke_role",[y(t.account),x(t.role)])}function Ze(e,t){return G(e,"transfer_ownership",[y(t.newOwner),f(t.liveUntilLedger)])}function Je(e){return G(e,"accept_ownership",[])}function Ye(e,t){return G(e,"set_swap_aggregator",[y(t.aggregator)])}function et(e,t){return G(e,"set_price_aggregator",[y(t.aggregator)])}const tt=Ye;function rt(e,t){return G(e,"set_accumulator",[y(t.accumulator)])}function ot(e,t){return G(e,"set_position_limits",[Le(t)])}function nt(e,t){return G(e,"approve_blend_pool",[y(t.pool)])}function ut(e,t){return G(e,"revoke_blend_pool",[y(t.pool)])}const at=nt,it=ut;function lt(e,t){return G(e,"set_oracle",[Ce(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 G(e,"set_tolerance",[Ce(t.key),I({lower_ratio_bps:f(n),upper_ratio_bps:f(o)})])}function dt(e,t){return G(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 G(e,"set_oracle_sanity_bounds",[y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function St(e,t){return G(e,"update_indexes",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function gt(e,t){return G(e,"renew_account",[y(e.caller),h(t.accountNonce)])}function bt(e,t){return G(e,"create_liquidity_pool",[f(t.hubId),y(t.asset),Me(t.params)])}function yt(e,t){return G(e,"upgrade_liquidity_pool_params",[P(t.hubId,t.asset),Oe(t.params)])}function mt(e,t){return G(e,"claim_revenue",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function ft(e,t){return G(e,"add_rewards",[y(e.caller),R(t.rewards)])}function ht(e,t){return G(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",Le(t)),r)}function Lt(e,t){return Pt(e,xt("CreateHub"),t)}function Ct(e,t){return Pt(e,xt("AddSpoke"),t)}function Bt(e,t,r){return Pt(e,xt("RemoveSpoke",f(t.spokeId)),r)}function Nt(e,t,r){return Pt(e,xt("AddAssetToSpoke",At(t)),r)}function Ut(e,t,r){return Pt(e,xt("EditAssetInSpoke",At(t)),r)}function Gt(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 Kt(e,t,r){return Pt(e,xt("UpgradePool",q(t.wasmHash)),r)}function Zt(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:Ce((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:Ce((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:[],Lr=(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},Cr=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,Nr=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)}},Ur=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)}},Gr={"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:Cr(Mr(t[1])),updates:[...Mr(t[2]).map((e=>Lr(Mr(e),"Deposit"))),...Mr(t[3]).map((e=>Lr(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:Nr(e.key),oracle:Ur(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Rr(e.asset),oracle:Ur(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(Gr));function Dr(e,t){const r=_r(e),o=Gr[r];return o?o((0,c.scValToNative)(qr(t))):null}const Wr="XLENDXLM-a7c9f3",zr=1e4;function Hr(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${Wr}-${r}`}function Fr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function jr(e,t=0){return e*zr+t}function Vr(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 Xr=(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()},Qr=e=>e.baseUrl??i[e.network];async function Kr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=Xr(Qr(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=Xr(Qr(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 Jr=e=>M(e).toXDR("base64");function Yr(e,t){const r=e.routerAddress??p(e.network),o=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence),u=N(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",y(e.caller),m(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function eo(e,t){return Yr(e,t)}function to(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(no),splitPpm:e.splitPpm}))):[{hops:e.hops.map(no),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function ro(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:to(e,t)}const oo=to,no=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function uo(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function ao(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw uo(r.invokedContractId,e);throw e}}async function io(e,t,r){return ao(e,t.xdr,r)}function lo(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 so(e,t){return new Uint8Array(0)}const po=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 co(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(po(e.message)),c.xdr.ScVal.scvBytes(po(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 So={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 go(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=So[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>m.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>m.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>m.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>m.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>m.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>m.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>m.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>m.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>m.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>m.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>m.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>m.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>m.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>m.buildStellarApproveBlendPoolTx,buildStellarApproveTokenTx:()=>m.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>m.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>m.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>m.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>m.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>m.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>m.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>m.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>m.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>m.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>m.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>m.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>m.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>m.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>m.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>m.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>m.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>m.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>m.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>m.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>m.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>m.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>m.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>m.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>m.buildStellarMigrateTx,buildStellarMultiplyTx:()=>m.buildStellarMultiplyTx,buildStellarPauseTx:()=>m.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>m.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>m.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>m.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>m.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>m.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>m.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeConfigureMarketOracleTx:()=>m.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>m.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>m.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>m.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>m.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>m.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>m.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>m.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>m.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>m.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>m.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>m.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>m.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>m.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>m.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>m.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>m.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>m.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>m.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>m.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>m.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>m.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>m.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>m.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>m.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>m.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>m.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>m.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>m.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>m.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>m.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>m.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>m.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>m.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>m.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>m.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>m.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>m.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>m.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>m.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>m.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>m.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>m.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>m.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>m.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>m.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>m.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>m.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>m.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>m.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>m.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>m.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>m.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>m.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>m.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>m.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>m.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>m.buildStellarWithdrawTx,buildTx:()=>m.buildTx,decodeStellarLendingEvent:()=>m.decodeStellarLendingEvent,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/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})();