@xoxno/sdk-js 1.0.160 → 1.0.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sdk/stellar/__tests__/builders-hubasset.test.d.ts +12 -0
- package/dist/cjs/sdk/stellar/__tests__/export.test.d.ts +6 -0
- package/dist/cjs/sdk/stellar/__tests__/lending-read.test.d.ts +1 -0
- package/dist/cjs/sdk/stellar/index.d.ts +1 -0
- package/dist/cjs/sdk/stellar/lending-read-types.d.ts +259 -0
- package/dist/cjs/sdk/stellar/lending-read.d.ts +69 -0
- package/dist/cjs/sdk/stellar/lending.d.ts +128 -45
- package/dist/cjs/sdk/stellar/scval-encode.d.ts +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/__tests__/builders-hubasset.test.d.ts +12 -0
- package/dist/sdk/stellar/__tests__/export.test.d.ts +6 -0
- package/dist/sdk/stellar/__tests__/lending-read.test.d.ts +1 -0
- package/dist/sdk/stellar/index.cjs +1 -0
- package/dist/sdk/stellar/index.d.ts +1 -0
- package/dist/sdk/stellar/index.esm.js +1 -0
- package/dist/sdk/stellar/lending-read-types.d.ts +259 -0
- package/dist/sdk/stellar/lending-read.d.ts +69 -0
- package/dist/sdk/stellar/lending.d.ts +128 -45
- package/dist/sdk/stellar/scval-encode.d.ts +20 -0
- package/package.json +12 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var t={d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Chain:()=>i,STELLAR_AGGREGATOR_ROUTER:()=>m,STELLAR_GOVERNANCE:()=>g,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Zt,STELLAR_LENDING_CONTROLLER:()=>b,STELLAR_LENDING_TOPICS:()=>bo,STELLAR_NETWORK_PASSPHRASE:()=>S,STELLAR_QUOTE_URL:()=>q,STELLAR_SOROBAN_RPC_URL:()=>_,SYNTHETIC_EVENT_ORDER_STRIDE:()=>_o,XOXNOClient:()=>a,XOXNO_LENDING_STELLAR_TICKER:()=>go,buildSameTokenRepaySwapSteps:()=>Do,buildSdk:()=>Xo,buildStellarAcceptOwnershipTx:()=>Tt,buildStellarAddAssetToEModeCategoryTx:()=>Ot,buildStellarAddEModeCategoryTx:()=>Pt,buildStellarAddRewardsTx:()=>Wt,buildStellarApproveTokenTx:()=>Bt,buildStellarBatchSwapTx:()=>Mo,buildStellarBorrowBatchTx:()=>F,buildStellarBorrowTx:()=>Z,buildStellarCctpForwardTx:()=>zo,buildStellarClaimRevenueTx:()=>Ht,buildStellarConfigureMarketOracleTx:()=>Nt,buildStellarCreateLiquidityPoolTx:()=>jt,buildStellarDisableTokenOracleTx:()=>$t,buildStellarEditAssetConfigTx:()=>Et,buildStellarEditAssetInEModeCategoryTx:()=>It,buildStellarEditOracleToleranceTx:()=>Dt,buildStellarExecuteStrategyTx:()=>Po,buildStellarFlashLoanTx:()=>et,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Ge,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Ve,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Xe,buildStellarGovernanceExecuteTransferGovOwnTx:()=>He,buildStellarGovernanceExecuteTx:()=>ze,buildStellarGovernanceExecuteUpdateDelayTx:()=>je,buildStellarGrantRoleTx:()=>St,buildStellarLendingIdentifier:()=>qo,buildStellarLiquidateTx:()=>tt,buildStellarMigrateFromBlendTx:()=>ot,buildStellarMigrateTx:()=>gt,buildStellarMultiplyTx:()=>rt,buildStellarPauseTx:()=>_t,buildStellarProposeAddAssetToEModeTx:()=>_e,buildStellarProposeAddEModeCategoryTx:()=>me,buildStellarProposeApproveBlendPoolTx:()=>we,buildStellarProposeApproveTokenTx:()=>he,buildStellarProposeConfigureMarketOracleTx:()=>Ce,buildStellarProposeCreateLiquidityPoolTx:()=>xe,buildStellarProposeDeployPoolTx:()=>ke,buildStellarProposeDisableTokenOracleTx:()=>Me,buildStellarProposeEditAssetConfigTx:()=>ye,buildStellarProposeEditAssetInEModeTx:()=>qe,buildStellarProposeEditOracleToleranceTx:()=>Ue,buildStellarProposeGovernanceUpgradeTx:()=>Be,buildStellarProposeGrantGovernanceRoleTx:()=>Ne,buildStellarProposeMigrateControllerTx:()=>Oe,buildStellarProposeRemoveAssetFromEModeTx:()=>ve,buildStellarProposeRemoveEModeCategoryTx:()=>ge,buildStellarProposeRevokeBlendPoolTx:()=>Ae,buildStellarProposeRevokeGovernanceRoleTx:()=>De,buildStellarProposeRevokeTokenTx:()=>Te,buildStellarProposeSetAccumulatorTx:()=>de,buildStellarProposeSetAggregatorTx:()=>le,buildStellarProposeSetMinBorrowCollatTx:()=>be,buildStellarProposeSetPoolTemplateTx:()=>ce,buildStellarProposeSetPositionLimitsTx:()=>fe,buildStellarProposeTransferCtrlOwnershipTx:()=>Ie,buildStellarProposeTransferGovOwnTx:()=>$e,buildStellarProposeUpdateDelayTx:()=>Le,buildStellarProposeUpdatePoolCapsTx:()=>Se,buildStellarProposeUpgradeControllerTx:()=>Re,buildStellarProposeUpgradePoolParamsTx:()=>Ee,buildStellarProposeUpgradePoolTx:()=>Pe,buildStellarRemoveAssetFromEModeTx:()=>Ut,buildStellarRemoveEModeCategoryTx:()=>Mt,buildStellarRenewAccountTx:()=>Gt,buildStellarRepayBatchTx:()=>J,buildStellarRepayDebtWithCollateralTx:()=>it,buildStellarRepayTx:()=>Y,buildStellarRevokeRoleTx:()=>vt,buildStellarRevokeTokenTx:()=>Lt,buildStellarSetAccumulatorTx:()=>At,buildStellarSetAggregatorTx:()=>wt,buildStellarSetLiquidityPoolTemplateTx:()=>xt,buildStellarSetPositionLimitsTx:()=>kt,buildStellarSupplyBatchTx:()=>H,buildStellarSupplyTx:()=>W,buildStellarSwapCollateralTx:()=>ut,buildStellarSwapDebtTx:()=>nt,buildStellarTransferOwnershipTx:()=>ht,buildStellarUnpauseTx:()=>qt,buildStellarUpdateAccountThresholdTx:()=>Ft,buildStellarUpdateIndexesTx:()=>zt,buildStellarUpdatePoolCapsTx:()=>Ct,buildStellarUpgradeControllerTx:()=>mt,buildStellarUpgradeLiquidityPoolParamsTx:()=>Vt,buildStellarUpgradeLiquidityPoolTx:()=>Xt,buildStellarWithdrawBatchTx:()=>Q,buildStellarWithdrawTx:()=>K,buildTx:()=>X,decodeStellarLendingEvent:()=>mo,encodeAssetConfigRaw:()=>lt,encodeInterestRateModel:()=>st,encodeMarketOracleConfigInput:()=>bt,encodeMarketParamsRaw:()=>pt,encodeOracleSourceConfigInput:()=>ft,encodePositionLimits:()=>dt,encodeStrategyPayloadToRouteXdr:()=>ko,extractEventOrder:()=>So,getStellarAggregatorQuote:()=>Ao,getStellarAggregatorRouter:()=>h,getStellarGovernance:()=>T,getStellarLendingController:()=>v,getStellarQuoteTokens:()=>xo,isValidCollectionTicker:()=>s,isValidNftIdentifier:()=>p,mapQuoteResponseToAggregatorSwap:()=>Io,mapQuoteResponseToStrategyPayload:()=>Ro,mapQuoteResponseToStrategySwap:()=>Oo,mapStellarPositionActivityType:()=>ho,prepareStellarBuiltTx:()=>Lo,prepareStellarTxXdr:()=>Bo,stellarLendingDispatchKey:()=>Ze,syntheticEventOrder:()=>vo,tagStellarInvokedContractError:()=>Uo,toBase64Xdr:()=>We,toStellarPositionMode:()=>No});const o="https://api.xoxno.com",r="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",n="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",u="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var i;!function(t){t.MAINNET="1",t.DEVNET="D"}(i||(i={}));class a{apiUrl;chain;init;config;constructor({chain:t=i.MAINNET,apiUrl:e=o,...a}={}){this.apiUrl=e??{[i.MAINNET]:o,[i.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=a,this.config=t==i.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:r,DR_SC:n,KG_SC:u,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:r,DR_SC:n,KG_SC:u,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:a,cache:s,debug:p,headers:l,method:d="GET",...c}=o,y=l?.Authorization,f="Bearer undefined"===y?void 0:y,b={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...f?{Authorization:f}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:_,...q}=r??{},{revalidate:S,...v}=a??{},h="GET"!==d||f?void 0:S??_,T="GET"!==d||f||h?void 0:s??n,w={...i,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:T,next:{...q,...v,revalidate:h}};(p??u)&&console.debug("SDK fetch: ",g,w);const A=await fetch(g,w).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${g}: ${t.message}`),{cause:t});throw t})),x=await A.text();if(!A.ok){let t;try{t=JSON.parse(x)}catch{t={message:x}}const e=[g,A.status,A.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(x)}catch{return x}}}const s=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},p=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class l extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class d extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const c=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^G[A-Z2-7]{55}$/.test(t)),y={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/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:{}}}},f=["PATCH","POST","DELETE","PUT"],b={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},m={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},g={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},_={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},q={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"},S={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function v(t){const e=b[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function h(t){const e=m[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function T(t){const e=g[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const w=require("@stellar/stellar-sdk"),A=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],x=t=>new w.Address(t).toScVal(),E=t=>new w.ScInt(t).toI128(),k=t=>w.xdr.ScVal.scvU32(t),P=t=>new w.ScInt("string"==typeof t?t:t.toString()).toU64(),M=t=>w.xdr.ScVal.scvBool(t),R=t=>w.xdr.ScVal.scvString(t),O=t=>w.xdr.ScVal.scvSymbol(t),I=()=>w.xdr.ScVal.scvVoid(),C=t=>w.xdr.ScVal.scvVec(t),U=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return w.xdr.ScVal.scvBytes(r)},B=(t,e)=>null==t?I():e(t),L=(t,e)=>w.xdr.ScVal.scvVec([x(t),E(e)]),N=t=>w.xdr.ScVal.scvVec(t.map((t=>L(t.token,t.amount)))),D=t=>{const e=Object.keys(t).sort().map((e=>new w.xdr.ScMapEntry({key:O(e),val:t[e]})));return w.xdr.ScVal.scvMap(e)},$=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return D({amount_out:E(t.amountOut),pool:x(t.pool),token_in:x(t.tokenIn),token_out:x(t.tokenOut),venue:(e=t.venue,w.xdr.ScVal.scvVec([O(e)]))});var e}));return D({hops:w.xdr.ScVal.scvVec(e),split_ppm:k(t.splitPpm)})}));return D({paths:w.xdr.ScVal.scvVec(e),referral_id:P(t.referralId??0),token_in:x(t.tokenIn),token_out:x(t.tokenOut),total_min_out:E(t.totalMinOut)})},z=t=>{const e=Buffer.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return w.xdr.ScVal.scvBytes(e)},G=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},j=t=>{if("string"==typeof t)return z(G(t));if(t instanceof Uint8Array)return z(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?z(G(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?z(G(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?z(G(t.bytes)):z(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!A.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return e})(t),w.xdr.ScVal.scvBytes(Buffer.from($(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},V=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return w.xdr.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return w.xdr.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function X(t,e,o){const r=t.controllerAddress??v(t.network),n=new w.Contract(r),u=new w.Account(t.caller,t.sourceSequence);return{xdr:new w.TransactionBuilder(u,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(n.call(e,...o)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function H(t,e){const o=e.accountNonce??0,r=e.eModeCategory??0,n=N([...e.assets]);return X(t,"supply",[x(t.caller),P(o),k(r),n])}function W(t,e){return H(t,{accountNonce:e.accountNonce,eModeCategory:e.eModeCategory,assets:[{token:e.token,amount:e.amount}]})}function F(t,e){const o=N([...e.borrows]);return X(t,"borrow",[x(t.caller),P(e.accountNonce),o])}function Z(t,e){return F(t,{accountNonce:e.accountNonce,borrows:[{token:e.token,amount:e.amount}]})}function Q(t,e){const o=N([...e.withdrawals]);return X(t,"withdraw",[x(t.caller),P(e.accountNonce),o,B(e.to,x)])}function K(t,e){return Q(t,{accountNonce:e.accountNonce,withdrawals:[{token:e.token,amount:e.amount}]})}function J(t,e){const o=N([...e.payments]);return X(t,"repay",[x(t.caller),P(e.accountNonce),o])}function Y(t,e){return J(t,{accountNonce:e.accountNonce,payments:[{token:e.token,amount:e.amount}]})}function tt(t,e){const o=N(e.debtPayments.map((t=>({token:t.token,amount:t.amount}))));return X(t,"liquidate",[x(t.caller),P(e.accountNonce),o])}function et(t,e){return X(t,"flash_loan",[x(t.caller),x(e.asset),E(e.amount),x(e.receiver),V(e.data)])}function ot(t,e){return X(t,"migrate_from_blend",[x(t.caller),P(e.accountId),k(e.eModeCategory),x(e.blendPool),C(e.collateralTokens.map(x)),C(e.supplyTokens.map(x)),N(e.debtCaps.map((t=>({token:t.token,amount:t.cap}))))])}function rt(t,e){const o=e.accountNonce??0;return X(t,"multiply",[x(t.caller),P(o),k(e.eModeCategory),x(e.collateralToken),E(e.debtToFlashLoan),x(e.debtToken),k(e.mode),j(e.steps),B(e.initialPayment,(t=>L(t.token,t.amount))),B(e.convertSwap,j)])}function nt(t,e){return X(t,"swap_debt",[x(t.caller),P(e.accountNonce),x(e.existingDebtToken),E(e.newDebtAmount),x(e.newDebtToken),j(e.steps)])}function ut(t,e){return X(t,"swap_collateral",[x(t.caller),P(e.accountNonce),x(e.currentCollateral),E(e.fromAmount),x(e.newCollateral),j(e.steps)])}function it(t,e){return X(t,"repay_debt_with_collateral",[x(t.caller),P(e.accountNonce),x(e.collateralToken),E(e.collateralAmount),x(e.debtToken),j(e.steps),M(e.closePosition)])}const at={Single:0,PrimaryWithAnchor:1},st=t=>D({base_borrow_rate_ray:E(t.baseBorrowRateRay),max_borrow_rate_ray:E(t.maxBorrowRateRay),max_utilization_ray:E(t.maxUtilizationRay),mid_utilization_ray:E(t.midUtilizationRay),optimal_utilization_ray:E(t.optimalUtilizationRay),reserve_factor_bps:k(t.reserveFactorBps),slope1_ray:E(t.slope1Ray),slope2_ray:E(t.slope2Ray),slope3_ray:E(t.slope3Ray)}),pt=t=>D({asset_decimals:k(t.assetDecimals),asset_id:x(t.assetId),base_borrow_rate_ray:E(t.baseBorrowRateRay),borrow_cap:E(t.borrowCap),max_borrow_rate_ray:E(t.maxBorrowRateRay),max_utilization_ray:E(t.maxUtilizationRay),mid_utilization_ray:E(t.midUtilizationRay),optimal_utilization_ray:E(t.optimalUtilizationRay),reserve_factor_bps:k(t.reserveFactorBps),slope1_ray:E(t.slope1Ray),slope2_ray:E(t.slope2Ray),slope3_ray:E(t.slope3Ray),supply_cap:E(t.supplyCap)}),lt=t=>D({asset_decimals:k(0),e_mode_categories:C(t.eModeCategories.map((t=>k(t)))),flashloan_fee_bps:k(t.flashloanFeeBps),is_borrowable:M(t.isBorrowable),is_collateralizable:M(t.isCollateralizable),is_flashloanable:M(t.isFlashloanable),liquidation_bonus_bps:k(t.liquidationBonusBps),liquidation_fees_bps:k(t.liquidationFeesBps),liquidation_threshold_bps:k(t.liquidationThresholdBps),loan_to_value_bps:k(t.loanToValueBps)}),dt=t=>D({max_borrow_positions:k(t.maxBorrowPositions),max_supply_positions:k(t.maxSupplyPositions)}),ct=t=>{const e=t.kind;switch(e){case"Stellar":return C([O("Stellar"),x(t.value)]);case"Symbol":return C([O("Symbol"),O(t.value)]);case"String":return C([O("String"),R(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},yt=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return C([O("Twap"),k(e)])}return C([O("Spot")])},ft=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return C([O("Reflector"),D({asset:ct(t.asset),contract:x(t.contract),read_mode:yt(t.readMode,t.twapRecords)})])}if("RedStonePriceFeed"===e){if("string"!=typeof t.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof t.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return C([O("RedStone"),D({contract:x(t.contract),feed_id:R(t.feedId),max_stale_seconds:P(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},bt=t=>{const e=at[t.strategy];if(void 0===e)throw new Error(`Stellar builder: unknown oracle strategy "${t.strategy}"`);return D({anchor:(o=t.anchor,C(null==o?[O("None")]:[O("Some"),ft(o)])),max_price_stale_seconds:P(t.maxPriceStaleSeconds),max_sanity_price_wad:E(t.maxSanityPriceWad),min_sanity_price_wad:E(t.minSanityPriceWad),primary:ft(t.primary),strategy:k(e),tolerance_bps:k(t.toleranceBps)});var o};function mt(t,e){return X(t,"upgrade",[U(e.wasmHash)])}function gt(t,e){return X(t,"migrate",[k(e.newVersion)])}function _t(t){return X(t,"pause",[])}function qt(t){return X(t,"unpause",[])}function St(t,e){return X(t,"grant_role",[x(e.account),O(e.role)])}function vt(t,e){return X(t,"revoke_role",[x(e.account),O(e.role)])}function ht(t,e){return X(t,"transfer_ownership",[x(e.newOwner),k(e.liveUntilLedger)])}function Tt(t){return X(t,"accept_ownership",[])}function wt(t,e){return X(t,"set_aggregator",[x(e.aggregator)])}function At(t,e){return X(t,"set_accumulator",[x(e.accumulator)])}function xt(t,e){return X(t,"set_liquidity_pool_template",[U(e.wasmHash)])}function Et(t,e){return X(t,"edit_asset_config",[x(e.asset),lt(e.config)])}function kt(t,e){return X(t,"set_position_limits",[dt(e)])}function Pt(t){return X(t,"add_e_mode_category",[])}function Mt(t,e){return X(t,"remove_e_mode_category",[k(e.id)])}const Rt=t=>D({asset:x(t.asset),category_id:k(t.categoryId),can_collateral:M(t.canCollateral),can_borrow:M(t.canBorrow),ltv:k(t.ltv),threshold:k(t.threshold),bonus:k(t.bonus),supply_cap:E(t.supplyCap),borrow_cap:E(t.borrowCap)});function Ot(t,e){return X(t,"add_asset_to_e_mode_category",[Rt(e)])}function It(t,e){return X(t,"edit_asset_in_e_mode_category",[Rt(e)])}function Ct(t,e){return X(t,"update_pool_caps",[x(e.asset),E(e.supplyCap),E(e.borrowCap)])}function Ut(t,e){return X(t,"remove_asset_from_e_mode",[x(e.asset),k(e.categoryId)])}function Bt(t,e){return X(t,"approve_token",[x(e.token)])}function Lt(t,e){return X(t,"revoke_token",[x(e.token)])}function Nt(t,e){return X(t,"configure_market_oracle",[x(t.caller),x(e.asset),bt(e.config)])}function Dt(t,e){return X(t,"edit_oracle_tolerance",[x(t.caller),x(e.asset),k(e.tolerance)])}function $t(t,e){return X(t,"disable_token_oracle",[x(t.caller),x(e.asset)])}function zt(t,e){return X(t,"update_indexes",[x(t.caller),C(e.assets.map((t=>x(t))))])}function Gt(t,e){return X(t,"renew_account",[x(t.caller),P(e.accountNonce)])}function jt(t,e){return X(t,"create_liquidity_pool",[x(e.asset),pt(e.params),lt(e.config)])}function Vt(t,e){return X(t,"upgrade_liquidity_pool_params",[x(e.asset),st(e.params)])}function Xt(t,e){return X(t,"upgrade_liquidity_pool",[x(e.asset),U(e.wasmHash)])}function Ht(t,e){return X(t,"claim_revenue",[x(t.caller),C(e.assets.map((t=>x(t))))])}function Wt(t,e){return X(t,"add_rewards",[x(t.caller),C(e.rewards.map((t=>C([x(t.token),E(t.amount)]))))])}function Ft(t,e){return X(t,"update_account_threshold",[x(t.caller),x(e.asset),M(e.hasRisks),C(e.accountNonces.map((t=>P(t))))])}const Zt="00".repeat(32),Qt=t=>{if("string"==typeof t)return U(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return w.xdr.ScVal.scvBytes(e)},Kt=(t,...e)=>C([O(t),...e]),Jt=t=>D({asset:x(t.asset),category_id:k(t.categoryId),can_collateral:M(t.canCollateral),can_borrow:M(t.canBorrow),ltv:k(t.ltv),threshold:k(t.threshold),bonus:k(t.bonus),supply_cap:E(t.supplyCap),borrow_cap:E(t.borrowCap)}),Yt=t=>D({asset:x(t.asset),supply_cap:E(t.supplyCap),borrow_cap:E(t.borrowCap)}),te=t=>D({asset:x(t.asset),category_id:k(t.categoryId)}),ee=t=>D({asset:x(t.asset),params:pt(t.params),config:lt(t.config)}),oe=t=>D({asset:x(t.asset),params:st(t.params)}),re=t=>D({new_owner:x(t.newOwner),live_until_ledger:k(t.liveUntilLedger)}),ne=t=>D({asset:x(t.asset),cfg:bt(t.config)}),ue=t=>D({asset:x(t.asset),tolerance:k(t.tolerance)}),ie=t=>D({account:x(t.account),role:O(t.role)});function ae(t,e,o){const r=t.governanceAddress??T(t.network),n=new w.Contract(r),u=new w.Account(t.caller,t.sourceSequence);return{xdr:new w.TransactionBuilder(u,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(n.call(e,...o)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const se=(t,e,o)=>ae(t,"propose",[x(t.caller),e,Qt(o)]),pe=(t,e,o)=>ae(t,"execute_self",[I(),e,Qt(o)]);function le(t,e,o){return se(t,Kt("SetAggregator",x(e.aggregator)),o)}function de(t,e,o){return se(t,Kt("SetAccumulator",x(e.accumulator)),o)}function ce(t,e,o){return se(t,Kt("SetLiquidityPoolTemplate",U(e.wasmHash)),o)}function ye(t,e,o){return se(t,Kt("EditAssetConfig",x(e.asset),lt(e.config)),o)}function fe(t,e,o){return se(t,Kt("SetPositionLimits",dt(e)),o)}function be(t,e,o){return se(t,Kt("SetMinBorrowCollateralUsd",E(e.floorWad)),o)}function me(t,e){return se(t,Kt("AddEModeCategory"),e)}function ge(t,e,o){return se(t,Kt("RemoveEModeCategory",k(e.id)),o)}function _e(t,e,o){return se(t,Kt("AddAssetToEModeCategory",Jt(e)),o)}function qe(t,e,o){return se(t,Kt("EditAssetInEModeCategory",Jt(e)),o)}function Se(t,e,o){return se(t,Kt("UpdatePoolCaps",Yt(e)),o)}function ve(t,e,o){return se(t,Kt("RemoveAssetFromEMode",te(e)),o)}function he(t,e,o){return se(t,Kt("ApproveToken",x(e.token)),o)}function Te(t,e,o){return se(t,Kt("RevokeToken",x(e.token)),o)}function we(t,e,o){return se(t,Kt("ApproveBlendPool",x(e.pool)),o)}function Ae(t,e,o){return se(t,Kt("RevokeBlendPool",x(e.pool)),o)}function xe(t,e,o){return se(t,Kt("CreateLiquidityPool",ee(e)),o)}function Ee(t,e,o){return se(t,Kt("UpgradeLiquidityPoolParams",oe(e)),o)}function ke(t,e){return se(t,Kt("DeployPool"),e)}function Pe(t,e,o){return se(t,Kt("UpgradePool",U(e.wasmHash)),o)}function Me(t,e,o){return se(t,Kt("DisableTokenOracle",x(e.asset)),o)}function Re(t,e,o){return se(t,Kt("UpgradeController",U(e.wasmHash)),o)}function Oe(t,e,o){return se(t,Kt("MigrateController",k(e.newVersion)),o)}function Ie(t,e,o){return se(t,Kt("TransferCtrlOwnership",re(e)),o)}function Ce(t,e,o){return se(t,Kt("ConfigureMarketOracle",ne(e)),o)}function Ue(t,e,o){return se(t,Kt("EditOracleTolerance",ue(e)),o)}function Be(t,e,o){return se(t,Kt("UpgradeGov",U(e.wasmHash)),o)}function Le(t,e,o){return se(t,Kt("UpdateGovDelay",k(e.newDelay)),o)}function Ne(t,e,o){return se(t,Kt("GrantGovRole",ie(e)),o)}function De(t,e,o){return se(t,Kt("RevokeGovRole",ie(e)),o)}function $e(t,e,o){return se(t,Kt("TransferGovOwnership",re(e)),o)}function ze(t,e){const o=C(e.argsXdr.map((t=>w.xdr.ScVal.fromXDR(t,"base64")))),r=Qt(e.predecessor??Zt);return ae(t,"execute",[I(),x(e.target),O(e.functionName),o,r,Qt(e.salt)])}function Ge(t,e,o){return pe(t,Kt("UpgradeGov",U(e.wasmHash)),o)}function je(t,e,o){return pe(t,Kt("UpdateGovDelay",k(e.newDelay)),o)}function Ve(t,e,o){return pe(t,Kt("GrantGovRole",ie(e)),o)}function Xe(t,e,o){return pe(t,Kt("RevokeGovRole",ie(e)),o)}function He(t,e,o){return pe(t,Kt("TransferGovOwnership",re(e)),o)}const We=t=>t.toXDR("base64"),Fe=t=>w.xdr.ScVal.fromXDR(t,"base64"),Ze=t=>t.map((t=>String((0,w.scValToNative)(Fe(t))))).join(":"),Qe=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Ke=t=>Number(t),Je=t=>String(t),Ye=t=>null==t?void 0:Qe(t),to=t=>null==t?void 0:Je(t),eo=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),oo=["None","Multiply","Long","Short"],ro=["Single","PrimaryWithAnchor"],no=["ReflectorSep40","RedStonePriceFeed"],uo=["Spot","Twap"],io=["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"],ao=t=>Array.isArray(t)?t:[],so=t=>({loanToValueBps:Ke(t.loan_to_value_bps),liquidationThresholdBps:Ke(t.liquidation_threshold_bps),liquidationBonusBps:Ke(t.liquidation_bonus_bps),liquidationFeesBps:Ke(t.liquidation_fees_bps),isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),isFlashloanable:Boolean(t.is_flashloanable),flashloanFeeBps:Ke(t.flashloan_fee_bps),eModeCategories:(t.e_mode_categories??[]).map(Ke)}),po=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],io[Ke(r)]??Qe(r)),positionType:e,asset:Je(t[1]),scaledAmountRay:Qe(t[2]),indexRay:Qe(t[3]),amount:Qe(t[4]),liquidationThresholdBps:o?void 0:Ke(t[5]),liquidationBonusBps:o?void 0:Ke(t[6]),loanToValueBps:o?void 0:Ke(t[7])};var r},lo=t=>{return{owner:Je(t[0]),eModeCategoryId:Ke(t[1]),mode:(e=t[2],oo[Ke(e)]??"None")};var e},co=(t,e)=>{const o=uo[Ke(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:Je(r)}:null!=n?{kind:"Symbol",value:Je(n)}:void 0;return{provider:no[Ke(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:Je(t[`${e}_contract`]),asset:u,feedId:to(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Ke(t[`${e}_twap_records`]):void 0,decimals:Ke(t[`${e}_decimals`]),resolutionSeconds:Ke(t[`${e}_resolution_seconds`]),maxStaleSeconds:Ke(t[`${e}_max_stale_seconds`])}},yo=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:Je(t.base_token_id),quoteTokenId:Je(t.quote_token_id),tolerance:{upperRatio:Ke(t.upper_ratio_bps??t.tolerance?.upper_ratio_bps),lowerRatio:Ke(t.lower_ratio_bps??t.tolerance?.lower_ratio_bps)},assetDecimals:Ke(t.asset_decimals),maxPriceStaleSeconds:Ke(t.max_price_stale_seconds),strategy:ro[Ke(t.strategy)]??"Single",primary:co(t,"primary"),anchor:e?co(t,"anchor"):void 0,primaryQuoteToken:to(t.primary_quote_token),anchorQuoteToken:to(t.anchor_quote_token),minSanityPriceWad:Ye(t.min_sanity_price_wad),maxSanityPriceWad:Ye(t.max_sanity_price_wad)}},fo={"market:create":t=>({topic:"market:create",data:{baseAsset:Je(t.base_asset),maxBorrowRate:Qe(t.max_borrow_rate),baseBorrowRate:Qe(t.base_borrow_rate),slope1:Qe(t.slope1),slope2:Qe(t.slope2),slope3:Qe(t.slope3),midUtilization:Qe(t.mid_utilization),optimalUtilization:Qe(t.optimal_utilization),maxUtilization:Ye(t.max_utilization),reserveFactor:Ke(t.reserve_factor),marketAddress:Je(t.market_address),config:so(t.config)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Je(t.asset),maxBorrowRateRay:Qe(t.max_borrow_rate_ray),baseBorrowRateRay:Qe(t.base_borrow_rate_ray),slope1Ray:Qe(t.slope1_ray),slope2Ray:Qe(t.slope2_ray),slope3Ray:Qe(t.slope3_ray),midUtilizationRay:Qe(t.mid_utilization_ray),optimalUtilizationRay:Qe(t.optimal_utilization_ray),maxUtilizationRay:Ye(t.max_utilization_ray),reserveFactorBps:Ke(t.reserve_factor_bps)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:ao(t).map((t=>{return e=ao(t),{asset:Je(e[0]),timestamp:Ke(e[1]),supplyIndexRay:Qe(e[2]),borrowIndexRay:Qe(e[3]),reservesRay:Qe(e[4]),suppliedRay:Qe(e[5]),borrowedRay:Qe(e[6]),revenueRay:Qe(e[7]),assetPriceWad:Ye(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:ao(t).map((t=>{const e=t;return{asset:Je(e.asset),params:(o=e.params,{maxBorrowRateRay:Qe(o.max_borrow_rate_ray),baseBorrowRateRay:Qe(o.base_borrow_rate_ray),slope1Ray:Qe(o.slope1_ray),slope2Ray:Qe(o.slope2_ray),slope3Ray:Qe(o.slope3_ray),midUtilizationRay:Qe(o.mid_utilization_ray),optimalUtilizationRay:Qe(o.optimal_utilization_ray),maxUtilizationRay:Ye(o.max_utilization_ray),reserveFactorBps:Ke(o.reserve_factor_bps),supplyCap:Qe(o.supply_cap),borrowCap:Qe(o.borrow_cap),assetId:to(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:Ke(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=ao(t);return{topic:"position:batch_update",data:{accountId:Qe(e[0]),accountAttributes:lo(ao(e[1])),updates:[...ao(e[2]).map((t=>po(ao(t),"Deposit"))),...ao(e[3]).map((t=>po(ao(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{asset:Je(t.asset),receiver:Je(t.receiver),caller:Je(t.caller),amount:Qe(t.amount),fee:Qe(t.fee)}}),"config:asset":t=>({topic:"config:asset",data:{asset:Je(t.asset),config:so(t.config)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Je(t.asset),oracle:yo(t.oracle)}}),"config:emode_category":t=>({topic:"config:emode_category",data:{category:{categoryId:Ke(t.category.category_id),isDeprecated:Boolean(t.category.is_deprecated)}}}),"config:emode_asset":t=>({topic:"config:emode_asset",data:{asset:Je(t.asset),config:{isCollateralizable:Boolean(t.config.is_collateralizable),isBorrowable:Boolean(t.config.is_borrowable),loanToValueBps:Ke(t.config.loan_to_value_bps),liquidationThresholdBps:Ke(t.config.liquidation_threshold_bps),liquidationBonusBps:Ke(t.config.liquidation_bonus_bps),supplyCap:Qe(t.config.supply_cap),borrowCap:Qe(t.config.borrow_cap)},categoryId:Ke(t.category_id)}}),"config:remove_emode_asset":t=>({topic:"config:remove_emode_asset",data:{asset:Je(t.asset),categoryId:Ke(t.category_id)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Qe(t.account_id),totalBorrowUsdWad:Qe(t.total_borrow_usd_wad),totalCollateralUsdWad:Qe(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Je(t.token),amount:Qe(t.amount),usdValueWad:Qe(t.usd_value_wad),accountId:Qe(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{asset:Je(t.asset),amount:Qe(t.amount),fee:Qe(t.fee),amountSent:Qe(t.amount_sent)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:eo(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Je(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Je(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:eo(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Ke(t.max_supply_positions),maxBorrowPositions:Ke(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Je(t.asset)}})},bo=Object.freeze(Object.keys(fo));function mo(t,e){const o=Ze(t),r=fo[o];return r?r((0,w.scValToNative)(Fe(e))):null}const go="XLENDXLM-a7c9f3",_o=1e4;function qo(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${go}-${o}`}function So(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function vo(t,e=0){return t*_o+e}function ho(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const To=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},wo=t=>t.baseUrl??q[t.network];async function Ao(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=To(wo(e),"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function xo(t){const e=To(wo(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const Eo=(t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t,ko=t=>$(t).toXDR("base64");function Po(t,e){const o=t.routerAddress??h(t.network),r=new w.Contract(o),n=new w.Account(t.caller,t.sourceSequence),u=j(Eo(e,t.referralId));return{xdr:new w.TransactionBuilder(n,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(r.call("execute_strategy",x(t.caller),E(t.totalIn),u)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function Mo(t,e){return Po(t,e)}function Ro(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(Co),splitPpm:t.splitPpm}))):[{hops:t.hops.map(Co),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function Oo(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Ro(t,e)}const Io=Ro,Co=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function Uo(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function Bo(t,e,o){const r=w.TransactionBuilder.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw Uo(o.invokedContractId,t);throw t}}async function Lo(t,e,o){return Bo(t,e.xdr,o)}function No(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function Do(t,e){return{paths:[{hops:[{amountOut:"0",pool:t,tokenIn:t,tokenOut:t,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:t,tokenOut:t,totalMinOut:e}}const $o=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function zo(t){const e=new w.Account(t.caller,t.sourceSequence),o=new w.Contract(t.forwarderAddress).call("mint_and_forward",w.xdr.ScVal.scvBytes($o(t.message)),w.xdr.ScVal.scvBytes($o(t.attestation)));return{xdr:new w.TransactionBuilder(e,{fee:t.fee??"10000000",networkPassphrase:S[t.network]}).addOperation(o).setTimeout(t.timeoutSeconds??120).build().toXDR()}}const Go=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),jo=()=>({static:{},params:{},leaves:[]});function Vo(t,e,o,r){const{input:n,output:u,...i}=e,a=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),a=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),p=/:address[^A-Z]/.test(t)||"address"in a,y=/:collection[^A-Z]/.test(t)||"collection"in a;if(p){const t=n.address;if(!c(t))throw new d(t)}if(y){const t=n.collection;if(Array.isArray(t)?t.some((t=>!s(t))):!s(t))throw new l(t)}const f=Object.fromEntries(Object.entries(a).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:b,auth:m,method:g,headers:_,cache:q,next:S,debug:v,continuationToken:h,...T}=f,w=m?`Bearer ${m}`:void 0,A={..._,...w?{Authorization:w}:{},...h?{"X-Continuation-Token":String(h)}:{}},x={...S,tags:[...S?.tags??[],u]};return r.fetchWithTimeout(u,{method:g,params:T,body:b,headers:A,cache:q,debug:v,...x?{next:x}:{}})},p=(t={})=>a(t);for(const t of Object.keys(i))f.includes(t)&&(p[t]=e=>a({...e,method:e.method??t.toUpperCase()}));return p}function Xo(t){const e=function(){const t=jo();for(const[e,o]of Object.entries(y)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=Go(t.slice(1));n=n.params[e]||=jo()}else{const e=Go(t);n=n.static[e]||=jo()}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let a;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];a=Vo(o,n,r,t)}else{a={};for(const{rawPath:o,def:n}of e.leaves)a[Go(o.split("/").pop().replace(/^:/,""))]=Vo(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===a[t]?a[t]=u:"function"==typeof a[t]?Object.assign(a[t],u):"function"==typeof u?(Object.assign(u,a[t]),a[t]=u):Object.assign(a[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(a[t]){const o=a[t];a[t]=t=>({...o(t),...e(t)})}else a[t]=e}return a};return o(e,{})}module.exports=e})();
|
|
1
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={454(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>u,STELLAR_GOVERNANCE:()=>n,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>tt,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>So,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>fo,XOXNO_LENDING_STELLAR_TICKER:()=>go,buildSameTokenRepaySwapSteps:()=>Go,buildStellarAcceptOwnershipTx:()=>Re,buildStellarAddAssetToEModeCategoryTx:()=>Ge,buildStellarAddEModeCategoryTx:()=>Le,buildStellarAddRewardsTx:()=>Ye,buildStellarApproveTokenTx:()=>ze,buildStellarBatchSwapTx:()=>Ro,buildStellarBorrowBatchTx:()=>B,buildStellarBorrowTx:()=>G,buildStellarCctpForwardTx:()=>Do,buildStellarClaimRevenueTx:()=>Je,buildStellarConfigureMarketOracleTx:()=>We,buildStellarCreateLiquidityPoolTx:()=>Qe,buildStellarDisableTokenOracleTx:()=>He,buildStellarEditAssetConfigTx:()=>Ce,buildStellarEditAssetInEModeCategoryTx:()=>Ne,buildStellarEditOracleToleranceTx:()=>je,buildStellarExecuteStrategyTx:()=>Eo,buildStellarFlashLoanTx:()=>W,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>zt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Wt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>jt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Ht,buildStellarGovernanceExecuteTx:()=>$t,buildStellarGovernanceExecuteUpdateDelayTx:()=>Vt,buildStellarGrantRoleTx:()=>we,buildStellarLendingIdentifier:()=>mo,buildStellarLiquidateTx:()=>V,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>he,buildStellarMultiplyTx:()=>H,buildStellarPauseTx:()=>qe,buildStellarProposeAddAssetToEModeTx:()=>ft,buildStellarProposeAddEModeCategoryTx:()=>Tt,buildStellarProposeApproveBlendPoolTx:()=>qt,buildStellarProposeApproveTokenTx:()=>vt,buildStellarProposeConfigureMarketOracleTx:()=>It,buildStellarProposeCreateLiquidityPoolTx:()=>wt,buildStellarProposeDeployPoolTx:()=>Et,buildStellarProposeDisableTokenOracleTx:()=>kt,buildStellarProposeEditAssetConfigTx:()=>yt,buildStellarProposeEditAssetInEModeTx:()=>mt,buildStellarProposeEditOracleToleranceTx:()=>Lt,buildStellarProposeGovernanceUpgradeTx:()=>Ut,buildStellarProposeGrantGovernanceRoleTx:()=>Gt,buildStellarProposeMigrateControllerTx:()=>Mt,buildStellarProposeRemoveAssetFromEModeTx:()=>_t,buildStellarProposeRemoveEModeCategoryTx:()=>gt,buildStellarProposeRevokeBlendPoolTx:()=>At,buildStellarProposeRevokeGovernanceRoleTx:()=>Nt,buildStellarProposeRevokeTokenTx:()=>ht,buildStellarProposeSetAccumulatorTx:()=>dt,buildStellarProposeSetAggregatorTx:()=>pt,buildStellarProposeSetMinBorrowCollatTx:()=>St,buildStellarProposeSetPoolTemplateTx:()=>ct,buildStellarProposeSetPositionLimitsTx:()=>bt,buildStellarProposeTransferCtrlOwnershipTx:()=>Ct,buildStellarProposeTransferGovOwnTx:()=>Dt,buildStellarProposeUpdateDelayTx:()=>Bt,buildStellarProposeUpdatePoolCapsTx:()=>xt,buildStellarProposeUpgradeControllerTx:()=>Ot,buildStellarProposeUpgradePoolParamsTx:()=>Pt,buildStellarProposeUpgradePoolTx:()=>Rt,buildStellarRemoveAssetFromEModeTx:()=>$e,buildStellarRemoveEModeCategoryTx:()=>Ue,buildStellarRenewAccountTx:()=>Fe,buildStellarRepayBatchTx:()=>$,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Pe,buildStellarRevokeTokenTx:()=>Ve,buildStellarSetAccumulatorTx:()=>Oe,buildStellarSetAggregatorTx:()=>ke,buildStellarSetLiquidityPoolTemplateTx:()=>Me,buildStellarSetPositionLimitsTx:()=>Ie,buildStellarSupplyBatchTx:()=>L,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>F,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Ee,buildStellarUnpauseTx:()=>Ae,buildStellarUpdateAccountThresholdTx:()=>et,buildStellarUpdateIndexesTx:()=>Xe,buildStellarUpdatePoolCapsTx:()=>De,buildStellarUpgradeControllerTx:()=>ve,buildStellarUpgradeLiquidityPoolParamsTx:()=>Ze,buildStellarUpgradeLiquidityPoolTx:()=>Ke,buildStellarWithdrawBatchTx:()=>N,buildStellarWithdrawTx:()=>D,buildTx:()=>I,decodeStellarLendingEvent:()=>To,encodeAssetConfigRaw:()=>Te,encodeInterestRateModel:()=>be,encodeMarketOracleConfigInput:()=>_e,encodeMarketParamsRaw:()=>Se,encodeOracleSourceConfigInput:()=>xe,encodePositionLimits:()=>ge,encodeStrategyPayloadToRouteXdr:()=>Po,extractEventOrder:()=>xo,getStellarAccountPositions:()=>ae,getStellarAggregatorQuote:()=>Ao,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>te,getStellarAssetGraph:()=>le,getStellarAssetMarkets:()=>oe,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ie,getStellarHub:()=>re,getStellarHubGraph:()=>se,getStellarLendingController:()=>s,getStellarQuoteTokens:()=>wo,getStellarReserve:()=>Y,getStellarReserveGraph:()=>de,getStellarReserveHolders:()=>ee,getStellarSpoke:()=>ue,getStellarSpokeGraph:()=>pe,getStellarUserPositions:()=>ne,mapQuoteResponseToAggregatorSwap:()=>Mo,mapQuoteResponseToStrategyPayload:()=>ko,mapQuoteResponseToStrategySwap:()=>Oo,mapStellarPositionActivityType:()=>vo,prepareStellarBuiltTx:()=>Uo,prepareStellarTxXdr:()=>Lo,stellarLendingDispatchKey:()=>Qt,stellarLendingRead:()=>ce,syntheticEventOrder:()=>_o,tagStellarInvokedContractError:()=>Io,toBase64Xdr:()=>Xt,toStellarPositionMode:()=>Bo});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},u={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},n={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=r[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=u[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=n[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"),y=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=e=>new c.Address(e).toScVal(),S=e=>new c.ScInt(e).toI128(),T=e=>c.xdr.ScVal.scvU32(e),g=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),f=e=>c.xdr.ScVal.scvBool(e),m=e=>c.xdr.ScVal.scvString(e),x=e=>c.xdr.ScVal.scvSymbol(e),_=()=>c.xdr.ScVal.scvVoid(),v=e=>c.xdr.ScVal.scvVec(e),h=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},q=(e,t)=>null==e?_():t(e),A=(e,t)=>E({asset:b(t),hub_id:T(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([A(e,t),S(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),E=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:x(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)},R=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return E({amount_out:S(e.amountOut),pool:b(e.pool),token_in:b(e.tokenIn),token_out:b(e.tokenOut),venue:(t=e.venue,c.xdr.ScVal.scvVec([x(t)]))});var t}));return E({hops:c.xdr.ScVal.scvVec(t),split_ppm:T(e.splitPpm)})}));return E({paths:c.xdr.ScVal.scvVec(t),referral_id:g(e.referralId??0),token_in:b(e.tokenIn),token_out:b(e.tokenOut),total_min_out:S(e.totalMinOut)})},k=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((o=e).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(t,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},M=e=>{if("string"==typeof e)return k(O(e));if(e instanceof Uint8Array)return k(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?k(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?k(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?k(O(e.bytes)):k(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!y.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},C=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function I(e,t,o){const r=e.controllerAddress??s(e.network),u=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(u.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function L(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return I(e,"supply",[b(e.caller),g(o),T(r),P([...t.assets])])}function U(e,t){return L(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function B(e,t){return I(e,"borrow",[b(e.caller),g(t.accountNonce),P([...t.borrows]),q(t.to,b)])}function G(e,t){return B(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function N(e,t){return I(e,"withdraw",[b(e.caller),g(t.accountNonce),P([...t.withdrawals]),q(t.to,b)])}function D(e,t){return N(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function $(e,t){return I(e,"repay",[b(e.caller),g(t.accountNonce),P([...t.payments])])}function z(e,t){return $(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function V(e,t){return I(e,"liquidate",[b(e.caller),g(t.accountNonce),P([...t.debtPayments])])}function W(e,t){return I(e,"flash_loan",[b(e.caller),A(t.hubId,t.asset),S(t.amount),b(t.receiver),C(t.data)])}function j(e,t){return I(e,"migrate_from_blend",[b(e.caller),g(t.accountId),T(t.spokeId),b(t.blendPool),v(t.collateralTokens.map(b)),v(t.supplyTokens.map(b)),(o=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(o.map((e=>{return t=e.token,o=e.amount,c.xdr.ScVal.scvVec([b(t),S(o)]);var t,o}))))]);var o}function H(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return I(e,"multiply",[b(e.caller),g(o),T(r),A(t.collateral.hubId,t.collateral.asset),S(t.debtToFlashLoan),A(t.debt.hubId,t.debt.asset),T(t.mode),M(t.steps),q(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),q(t.convertSwap,M)])}function X(e,t){return I(e,"swap_debt",[b(e.caller),g(t.accountNonce),A(t.existingDebt.hubId,t.existingDebt.asset),S(t.newDebtAmount),A(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function F(e,t){return I(e,"swap_collateral",[b(e.caller),g(t.accountNonce),A(t.current.hubId,t.current.asset),S(t.fromAmount),A(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Q(e,t){return I(e,"repay_debt_with_collateral",[b(e.caller),g(t.accountNonce),A(t.collateral.hubId,t.collateral.asset),S(t.collateralAmount),A(t.debt.hubId,t.debt.asset),M(t.steps),f(t.closePosition)])}const Z="/stellar-lending",K=25,J=encodeURIComponent,Y=(e,t,o,r,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}`,u),ee=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/holders`,{...n,params:{side:u}}),te=(e,t,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}`,o),oe=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/markets`,{...r,params:{side:o}}),re=(e,t,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,o),ue=(e,t,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,o),ne=(e,t,o)=>e.fetchWithTimeout(`${Z}/users/${J(t)}/positions`,o),ae=(e,t,o)=>e.fetchWithTimeout(`${Z}/accounts/${J(t)}/positions`,o),ie=(e,t={},o)=>{const{top:r=K,continuationToken:u}=t;return e.fetchWithTimeout(`${Z}/governance/proposals`,{...o,params:{top:r,...u?{continuationToken:u}:{}}})},le=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/graph`,{...r,params:{...o}}),se=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...r,params:{...o}}),pe=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...r,params:{...o}}),de=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/graph`,{...n,params:{...u}}),ce=e=>({reserve:(t,o,r,u)=>Y(e,t,o,r,u),reserveHolders:(t,o,r,u,n)=>ee(e,t,o,r,u,n),asset:(t,o)=>te(e,t,o),assetMarkets:(t,o,r)=>oe(e,t,o,r),hub:(t,o)=>re(e,t,o),spoke:(t,o)=>ue(e,t,o),userPositions:(t,o)=>ne(e,t,o),accountPositions:(t,o)=>ae(e,t,o),governanceProposals:(t,o)=>ie(e,t,o),assetGraph:(t,o,r)=>le(e,t,o,r),hubGraph:(t,o,r)=>se(e,t,o,r),spokeGraph:(t,o,r)=>pe(e,t,o,r),reserveGraph:(t,o,r,u,n)=>de(e,t,o,r,u,n)}),ye={Single:0,PrimaryWithAnchor:1},be=e=>E({base_borrow_rate_ray:S(e.baseBorrowRateRay),max_borrow_rate_ray:S(e.maxBorrowRateRay),max_utilization_ray:S(e.maxUtilizationRay),mid_utilization_ray:S(e.midUtilizationRay),optimal_utilization_ray:S(e.optimalUtilizationRay),reserve_factor_bps:T(e.reserveFactorBps),slope1_ray:S(e.slope1Ray),slope2_ray:S(e.slope2Ray),slope3_ray:S(e.slope3Ray)}),Se=e=>E({asset_decimals:T(e.assetDecimals),asset_id:b(e.assetId),base_borrow_rate_ray:S(e.baseBorrowRateRay),borrow_cap:S(e.borrowCap),max_borrow_rate_ray:S(e.maxBorrowRateRay),max_utilization_ray:S(e.maxUtilizationRay),mid_utilization_ray:S(e.midUtilizationRay),optimal_utilization_ray:S(e.optimalUtilizationRay),reserve_factor_bps:T(e.reserveFactorBps),slope1_ray:S(e.slope1Ray),slope2_ray:S(e.slope2Ray),slope3_ray:S(e.slope3Ray),supply_cap:S(e.supplyCap)}),Te=e=>E({asset_decimals:T(0),e_mode_categories:v(e.eModeCategories.map((e=>T(e)))),flashloan_fee_bps:T(e.flashloanFeeBps),is_borrowable:f(e.isBorrowable),is_collateralizable:f(e.isCollateralizable),is_flashloanable:f(e.isFlashloanable),liquidation_bonus_bps:T(e.liquidationBonusBps),liquidation_fees_bps:T(e.liquidationFeesBps),liquidation_threshold_bps:T(e.liquidationThresholdBps),loan_to_value_bps:T(e.loanToValueBps)}),ge=e=>E({max_borrow_positions:T(e.maxBorrowPositions),max_supply_positions:T(e.maxSupplyPositions)}),fe=e=>{const t=e.kind;switch(t){case"Stellar":return v([x("Stellar"),b(e.value)]);case"Symbol":return v([x("Symbol"),x(e.value)]);case"String":return v([x("String"),m(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},me=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return v([x("Twap"),T(t)])}return v([x("Spot")])},xe=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return v([x("Reflector"),E({asset:fe(e.asset),contract:b(e.contract),read_mode:me(e.readMode,e.twapRecords)})])}if("RedStonePriceFeed"===t){if("string"!=typeof e.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof e.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return v([x("RedStone"),E({contract:b(e.contract),feed_id:m(e.feedId),max_stale_seconds:g(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},_e=e=>{const t=ye[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return E({anchor:(o=e.anchor,v(null==o?[x("None")]:[x("Some"),xe(o)])),max_price_stale_seconds:g(e.maxPriceStaleSeconds),max_sanity_price_wad:S(e.maxSanityPriceWad),min_sanity_price_wad:S(e.minSanityPriceWad),primary:xe(e.primary),strategy:T(t),tolerance_bps:T(e.toleranceBps)});var o};function ve(e,t){return I(e,"upgrade",[h(t.wasmHash)])}function he(e,t){return I(e,"migrate",[T(t.newVersion)])}function qe(e){return I(e,"pause",[])}function Ae(e){return I(e,"unpause",[])}function we(e,t){return I(e,"grant_role",[b(t.account),x(t.role)])}function Pe(e,t){return I(e,"revoke_role",[b(t.account),x(t.role)])}function Ee(e,t){return I(e,"transfer_ownership",[b(t.newOwner),T(t.liveUntilLedger)])}function Re(e){return I(e,"accept_ownership",[])}function ke(e,t){return I(e,"set_aggregator",[b(t.aggregator)])}function Oe(e,t){return I(e,"set_accumulator",[b(t.accumulator)])}function Me(e,t){return I(e,"set_liquidity_pool_template",[h(t.wasmHash)])}function Ce(e,t){return I(e,"edit_asset_config",[b(t.asset),Te(t.config)])}function Ie(e,t){return I(e,"set_position_limits",[ge(t)])}function Le(e){return I(e,"add_e_mode_category",[])}function Ue(e,t){return I(e,"remove_e_mode_category",[T(t.id)])}const Be=e=>E({asset:b(e.asset),category_id:T(e.categoryId),can_collateral:f(e.canCollateral),can_borrow:f(e.canBorrow),ltv:T(e.ltv),threshold:T(e.threshold),bonus:T(e.bonus),supply_cap:S(e.supplyCap),borrow_cap:S(e.borrowCap)});function Ge(e,t){return I(e,"add_asset_to_e_mode_category",[Be(t)])}function Ne(e,t){return I(e,"edit_asset_in_e_mode_category",[Be(t)])}function De(e,t){return I(e,"update_pool_caps",[b(t.asset),S(t.supplyCap),S(t.borrowCap)])}function $e(e,t){return I(e,"remove_asset_from_e_mode",[b(t.asset),T(t.categoryId)])}function ze(e,t){return I(e,"approve_token",[b(t.token)])}function Ve(e,t){return I(e,"revoke_token",[b(t.token)])}function We(e,t){return I(e,"configure_market_oracle",[b(e.caller),b(t.asset),_e(t.config)])}function je(e,t){return I(e,"edit_oracle_tolerance",[b(e.caller),b(t.asset),T(t.tolerance)])}function He(e,t){return I(e,"disable_token_oracle",[b(e.caller),b(t.asset)])}function Xe(e,t){return I(e,"update_indexes",[b(e.caller),v(t.assets.map((e=>b(e))))])}function Fe(e,t){return I(e,"renew_account",[b(e.caller),g(t.accountNonce)])}function Qe(e,t){return I(e,"create_liquidity_pool",[b(t.asset),Se(t.params),Te(t.config)])}function Ze(e,t){return I(e,"upgrade_liquidity_pool_params",[b(t.asset),be(t.params)])}function Ke(e,t){return I(e,"upgrade_liquidity_pool",[b(t.asset),h(t.wasmHash)])}function Je(e,t){return I(e,"claim_revenue",[b(e.caller),v(t.assets.map((e=>b(e))))])}function Ye(e,t){return I(e,"add_rewards",[b(e.caller),v(t.rewards.map((e=>v([b(e.token),S(e.amount)]))))])}function et(e,t){return I(e,"update_account_threshold",[b(e.caller),b(t.asset),f(t.hasRisks),v(t.accountNonces.map((e=>g(e))))])}const tt="00".repeat(32),ot=e=>{if("string"==typeof e)return h(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)},rt=(e,...t)=>v([x(e),...t]),ut=e=>E({asset:b(e.asset),category_id:T(e.categoryId),can_collateral:f(e.canCollateral),can_borrow:f(e.canBorrow),ltv:T(e.ltv),threshold:T(e.threshold),bonus:T(e.bonus),supply_cap:S(e.supplyCap),borrow_cap:S(e.borrowCap)}),nt=e=>E({new_owner:b(e.newOwner),live_until_ledger:T(e.liveUntilLedger)}),at=e=>E({account:b(e.account),role:x(e.role)});function it(e,t,o){const r=e.governanceAddress??d(e.network),u=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(u.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const lt=(e,t,o)=>it(e,"propose",[b(e.caller),t,ot(o)]),st=(e,t,o)=>it(e,"execute_self",[_(),t,ot(o)]);function pt(e,t,o){return lt(e,rt("SetAggregator",b(t.aggregator)),o)}function dt(e,t,o){return lt(e,rt("SetAccumulator",b(t.accumulator)),o)}function ct(e,t,o){return lt(e,rt("SetLiquidityPoolTemplate",h(t.wasmHash)),o)}function yt(e,t,o){return lt(e,rt("EditAssetConfig",b(t.asset),Te(t.config)),o)}function bt(e,t,o){return lt(e,rt("SetPositionLimits",ge(t)),o)}function St(e,t,o){return lt(e,rt("SetMinBorrowCollateralUsd",S(t.floorWad)),o)}function Tt(e,t){return lt(e,rt("AddEModeCategory"),t)}function gt(e,t,o){return lt(e,rt("RemoveEModeCategory",T(t.id)),o)}function ft(e,t,o){return lt(e,rt("AddAssetToEModeCategory",ut(t)),o)}function mt(e,t,o){return lt(e,rt("EditAssetInEModeCategory",ut(t)),o)}function xt(e,t,o){return lt(e,rt("UpdatePoolCaps",E({asset:b((r=t).asset),supply_cap:S(r.supplyCap),borrow_cap:S(r.borrowCap)})),o);var r}function _t(e,t,o){return lt(e,rt("RemoveAssetFromEMode",E({asset:b((r=t).asset),category_id:T(r.categoryId)})),o);var r}function vt(e,t,o){return lt(e,rt("ApproveToken",b(t.token)),o)}function ht(e,t,o){return lt(e,rt("RevokeToken",b(t.token)),o)}function qt(e,t,o){return lt(e,rt("ApproveBlendPool",b(t.pool)),o)}function At(e,t,o){return lt(e,rt("RevokeBlendPool",b(t.pool)),o)}function wt(e,t,o){return lt(e,rt("CreateLiquidityPool",E({asset:b((r=t).asset),params:Se(r.params),config:Te(r.config)})),o);var r}function Pt(e,t,o){return lt(e,rt("UpgradeLiquidityPoolParams",E({asset:b((r=t).asset),params:be(r.params)})),o);var r}function Et(e,t){return lt(e,rt("DeployPool"),t)}function Rt(e,t,o){return lt(e,rt("UpgradePool",h(t.wasmHash)),o)}function kt(e,t,o){return lt(e,rt("DisableTokenOracle",b(t.asset)),o)}function Ot(e,t,o){return lt(e,rt("UpgradeController",h(t.wasmHash)),o)}function Mt(e,t,o){return lt(e,rt("MigrateController",T(t.newVersion)),o)}function Ct(e,t,o){return lt(e,rt("TransferCtrlOwnership",nt(t)),o)}function It(e,t,o){return lt(e,rt("ConfigureMarketOracle",E({asset:b((r=t).asset),cfg:_e(r.config)})),o);var r}function Lt(e,t,o){return lt(e,rt("EditOracleTolerance",E({asset:b((r=t).asset),tolerance:T(r.tolerance)})),o);var r}function Ut(e,t,o){return lt(e,rt("UpgradeGov",h(t.wasmHash)),o)}function Bt(e,t,o){return lt(e,rt("UpdateGovDelay",T(t.newDelay)),o)}function Gt(e,t,o){return lt(e,rt("GrantGovRole",at(t)),o)}function Nt(e,t,o){return lt(e,rt("RevokeGovRole",at(t)),o)}function Dt(e,t,o){return lt(e,rt("TransferGovOwnership",nt(t)),o)}function $t(e,t){const o=v(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=ot(t.predecessor??tt);return it(e,"execute",[_(),b(t.target),x(t.functionName),o,r,ot(t.salt)])}function zt(e,t,o){return st(e,rt("UpgradeGov",h(t.wasmHash)),o)}function Vt(e,t,o){return st(e,rt("UpdateGovDelay",T(t.newDelay)),o)}function Wt(e,t,o){return st(e,rt("GrantGovRole",at(t)),o)}function jt(e,t,o){return st(e,rt("RevokeGovRole",at(t)),o)}function Ht(e,t,o){return st(e,rt("TransferGovOwnership",nt(t)),o)}const Xt=e=>e.toXDR("base64"),Ft=e=>c.xdr.ScVal.fromXDR(e,"base64"),Qt=e=>e.map((e=>String((0,c.scValToNative)(Ft(e))))).join(":"),Zt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Kt=e=>Number(e),Jt=e=>String(e),Yt=e=>null==e?void 0:Zt(e),eo=e=>null==e?void 0:Jt(e),to=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),oo=["None","Multiply","Long","Short"],ro=["Single","PrimaryWithAnchor"],uo=["ReflectorSep40","RedStonePriceFeed"],no=["Spot","Twap"],ao=["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"],io=e=>Array.isArray(e)?e:[],lo=e=>({loanToValueBps:Kt(e.loan_to_value_bps),liquidationThresholdBps:Kt(e.liquidation_threshold_bps),liquidationBonusBps:Kt(e.liquidation_bonus_bps),liquidationFeesBps:Kt(e.liquidation_fees_bps),isCollateralizable:Boolean(e.is_collateralizable),isBorrowable:Boolean(e.is_borrowable),isFlashloanable:Boolean(e.is_flashloanable),flashloanFeeBps:Kt(e.flashloan_fee_bps),eModeCategories:(e.e_mode_categories??[]).map(Kt)}),so=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],ao[Kt(r)]??Zt(r)),positionType:t,asset:Jt(e[1]),scaledAmountRay:Zt(e[2]),indexRay:Zt(e[3]),amount:Zt(e[4]),liquidationThresholdBps:o?void 0:Kt(e[5]),liquidationBonusBps:o?void 0:Kt(e[6]),loanToValueBps:o?void 0:Kt(e[7])};var r},po=e=>{return{owner:Jt(e[0]),eModeCategoryId:Kt(e[1]),mode:(t=e[2],oo[Kt(t)]??"None")};var t},co=(e,t)=>{const o=no[Kt(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],u=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:Jt(r)}:null!=u?{kind:"Symbol",value:Jt(u)}:void 0;return{provider:uo[Kt(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:Jt(e[`${t}_contract`]),asset:n,feedId:eo(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Kt(e[`${t}_twap_records`]):void 0,decimals:Kt(e[`${t}_decimals`]),resolutionSeconds:Kt(e[`${t}_resolution_seconds`]),maxStaleSeconds:Kt(e[`${t}_max_stale_seconds`])}},yo=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:Jt(e.base_token_id),quoteTokenId:Jt(e.quote_token_id),tolerance:{upperRatio:Kt(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Kt(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Kt(e.asset_decimals),maxPriceStaleSeconds:Kt(e.max_price_stale_seconds),strategy:ro[Kt(e.strategy)]??"Single",primary:co(e,"primary"),anchor:t?co(e,"anchor"):void 0,primaryQuoteToken:eo(e.primary_quote_token),anchorQuoteToken:eo(e.anchor_quote_token),minSanityPriceWad:Yt(e.min_sanity_price_wad),maxSanityPriceWad:Yt(e.max_sanity_price_wad)}},bo={"market:create":e=>({topic:"market:create",data:{baseAsset:Jt(e.base_asset),maxBorrowRate:Zt(e.max_borrow_rate),baseBorrowRate:Zt(e.base_borrow_rate),slope1:Zt(e.slope1),slope2:Zt(e.slope2),slope3:Zt(e.slope3),midUtilization:Zt(e.mid_utilization),optimalUtilization:Zt(e.optimal_utilization),maxUtilization:Yt(e.max_utilization),reserveFactor:Kt(e.reserve_factor),marketAddress:Jt(e.market_address),config:lo(e.config)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Jt(e.asset),maxBorrowRateRay:Zt(e.max_borrow_rate_ray),baseBorrowRateRay:Zt(e.base_borrow_rate_ray),slope1Ray:Zt(e.slope1_ray),slope2Ray:Zt(e.slope2_ray),slope3Ray:Zt(e.slope3_ray),midUtilizationRay:Zt(e.mid_utilization_ray),optimalUtilizationRay:Zt(e.optimal_utilization_ray),maxUtilizationRay:Yt(e.max_utilization_ray),reserveFactorBps:Kt(e.reserve_factor_bps)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:io(e).map((e=>{return t=io(e),{asset:Jt(t[0]),timestamp:Kt(t[1]),supplyIndexRay:Zt(t[2]),borrowIndexRay:Zt(t[3]),reservesRay:Zt(t[4]),suppliedRay:Zt(t[5]),borrowedRay:Zt(t[6]),revenueRay:Zt(t[7]),assetPriceWad:Yt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:io(e).map((e=>{const t=e;return{asset:Jt(t.asset),params:(o=t.params,{maxBorrowRateRay:Zt(o.max_borrow_rate_ray),baseBorrowRateRay:Zt(o.base_borrow_rate_ray),slope1Ray:Zt(o.slope1_ray),slope2Ray:Zt(o.slope2_ray),slope3Ray:Zt(o.slope3_ray),midUtilizationRay:Zt(o.mid_utilization_ray),optimalUtilizationRay:Zt(o.optimal_utilization_ray),maxUtilizationRay:Yt(o.max_utilization_ray),reserveFactorBps:Kt(o.reserve_factor_bps),supplyCap:Zt(o.supply_cap),borrowCap:Zt(o.borrow_cap),assetId:eo(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:Kt(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=io(e);return{topic:"position:batch_update",data:{accountId:Zt(t[0]),accountAttributes:po(io(t[1])),updates:[...io(t[2]).map((e=>so(io(e),"Deposit"))),...io(t[3]).map((e=>so(io(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{asset:Jt(e.asset),receiver:Jt(e.receiver),caller:Jt(e.caller),amount:Zt(e.amount),fee:Zt(e.fee)}}),"config:asset":e=>({topic:"config:asset",data:{asset:Jt(e.asset),config:lo(e.config)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Jt(e.asset),oracle:yo(e.oracle)}}),"config:emode_category":e=>({topic:"config:emode_category",data:{category:{categoryId:Kt(e.category.category_id),isDeprecated:Boolean(e.category.is_deprecated)}}}),"config:emode_asset":e=>({topic:"config:emode_asset",data:{asset:Jt(e.asset),config:{isCollateralizable:Boolean(e.config.is_collateralizable),isBorrowable:Boolean(e.config.is_borrowable),loanToValueBps:Kt(e.config.loan_to_value_bps),liquidationThresholdBps:Kt(e.config.liquidation_threshold_bps),liquidationBonusBps:Kt(e.config.liquidation_bonus_bps),supplyCap:Zt(e.config.supply_cap),borrowCap:Zt(e.config.borrow_cap)},categoryId:Kt(e.category_id)}}),"config:remove_emode_asset":e=>({topic:"config:remove_emode_asset",data:{asset:Jt(e.asset),categoryId:Kt(e.category_id)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Zt(e.account_id),totalBorrowUsdWad:Zt(e.total_borrow_usd_wad),totalCollateralUsdWad:Zt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Jt(e.token),amount:Zt(e.amount),usdValueWad:Zt(e.usd_value_wad),accountId:Zt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{asset:Jt(e.asset),amount:Zt(e.amount),fee:Zt(e.fee),amountSent:Zt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:to(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Jt(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Jt(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:to(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Kt(e.max_supply_positions),maxBorrowPositions:Kt(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Jt(e.asset)}})},So=Object.freeze(Object.keys(bo));function To(e,t){const o=Qt(e),r=bo[o];return r?r((0,c.scValToNative)(Ft(t))):null}const go="XLENDXLM-a7c9f3",fo=1e4;function mo(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${go}-${o}`}function xo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function _o(e,t=0){return e*fo+t}function vo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const ho=(e,t,o)=>{const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(o)for(const[e,t]of Object.entries(o))void 0!==t&&r.searchParams.set(e,String(t));return r.toString()},qo=e=>e.baseUrl??i[e.network];async function Ao(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=ho(qo(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),r=await fetch(o,t.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${e}`)}return await r.json()}async function wo(e){const t=ho(qo(e),"api/v1/tokens"),o=await fetch(t,e.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${t} — ${e}`)}return await o.json()}const Po=e=>R(e).toXDR("base64");function Eo(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence),n=M(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",b(e.caller),S(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Ro(e,t){return Eo(e,t)}function ko(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(Co),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Co),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Oo(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:ko(e,t)}const Mo=ko,Co=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Io(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Lo(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Io(o.invokedContractId,e);throw e}}async function Uo(e,t,o){return Lo(e,t.xdr,o)}function Bo(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 Go(e,t){return{paths:[{hops:[{amountOut:"0",pool:e,tokenIn:e,tokenOut:e,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:e,tokenOut:e,totalMinOut:t}}const No=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 Do(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(No(e.message)),c.xdr.ScVal.scvBytes(No(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(o).setTimeout(e.timeoutSeconds??120).build().toXDR()}}}},t={};function o(r){var u=t[r];if(void 0!==u)return u.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>g.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>g.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>g.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>g.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>g.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>g.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>g.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>g.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>g.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>g.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>g.buildSameTokenRepaySwapSteps,buildSdk:()=>_,buildStellarAcceptOwnershipTx:()=>g.buildStellarAcceptOwnershipTx,buildStellarAddAssetToEModeCategoryTx:()=>g.buildStellarAddAssetToEModeCategoryTx,buildStellarAddEModeCategoryTx:()=>g.buildStellarAddEModeCategoryTx,buildStellarAddRewardsTx:()=>g.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>g.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>g.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>g.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>g.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>g.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>g.buildStellarClaimRevenueTx,buildStellarConfigureMarketOracleTx:()=>g.buildStellarConfigureMarketOracleTx,buildStellarCreateLiquidityPoolTx:()=>g.buildStellarCreateLiquidityPoolTx,buildStellarDisableTokenOracleTx:()=>g.buildStellarDisableTokenOracleTx,buildStellarEditAssetConfigTx:()=>g.buildStellarEditAssetConfigTx,buildStellarEditAssetInEModeCategoryTx:()=>g.buildStellarEditAssetInEModeCategoryTx,buildStellarEditOracleToleranceTx:()=>g.buildStellarEditOracleToleranceTx,buildStellarExecuteStrategyTx:()=>g.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>g.buildStellarFlashLoanTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>g.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>g.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>g.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>g.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>g.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>g.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGrantRoleTx:()=>g.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>g.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>g.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>g.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>g.buildStellarMigrateTx,buildStellarMultiplyTx:()=>g.buildStellarMultiplyTx,buildStellarPauseTx:()=>g.buildStellarPauseTx,buildStellarProposeAddAssetToEModeTx:()=>g.buildStellarProposeAddAssetToEModeTx,buildStellarProposeAddEModeCategoryTx:()=>g.buildStellarProposeAddEModeCategoryTx,buildStellarProposeApproveBlendPoolTx:()=>g.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>g.buildStellarProposeApproveTokenTx,buildStellarProposeConfigureMarketOracleTx:()=>g.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateLiquidityPoolTx:()=>g.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>g.buildStellarProposeDeployPoolTx,buildStellarProposeDisableTokenOracleTx:()=>g.buildStellarProposeDisableTokenOracleTx,buildStellarProposeEditAssetConfigTx:()=>g.buildStellarProposeEditAssetConfigTx,buildStellarProposeEditAssetInEModeTx:()=>g.buildStellarProposeEditAssetInEModeTx,buildStellarProposeEditOracleToleranceTx:()=>g.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>g.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>g.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>g.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromEModeTx:()=>g.buildStellarProposeRemoveAssetFromEModeTx,buildStellarProposeRemoveEModeCategoryTx:()=>g.buildStellarProposeRemoveEModeCategoryTx,buildStellarProposeRevokeBlendPoolTx:()=>g.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>g.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>g.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>g.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>g.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>g.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>g.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>g.buildStellarProposeSetPositionLimitsTx,buildStellarProposeTransferCtrlOwnershipTx:()=>g.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>g.buildStellarProposeTransferGovOwnTx,buildStellarProposeUpdateDelayTx:()=>g.buildStellarProposeUpdateDelayTx,buildStellarProposeUpdatePoolCapsTx:()=>g.buildStellarProposeUpdatePoolCapsTx,buildStellarProposeUpgradeControllerTx:()=>g.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>g.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>g.buildStellarProposeUpgradePoolTx,buildStellarRemoveAssetFromEModeTx:()=>g.buildStellarRemoveAssetFromEModeTx,buildStellarRemoveEModeCategoryTx:()=>g.buildStellarRemoveEModeCategoryTx,buildStellarRenewAccountTx:()=>g.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>g.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>g.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>g.buildStellarRepayTx,buildStellarRevokeRoleTx:()=>g.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>g.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>g.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>g.buildStellarSetAggregatorTx,buildStellarSetLiquidityPoolTemplateTx:()=>g.buildStellarSetLiquidityPoolTemplateTx,buildStellarSetPositionLimitsTx:()=>g.buildStellarSetPositionLimitsTx,buildStellarSupplyBatchTx:()=>g.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>g.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>g.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>g.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>g.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>g.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>g.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>g.buildStellarUpdateIndexesTx,buildStellarUpdatePoolCapsTx:()=>g.buildStellarUpdatePoolCapsTx,buildStellarUpgradeControllerTx:()=>g.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>g.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarUpgradeLiquidityPoolTx:()=>g.buildStellarUpgradeLiquidityPoolTx,buildStellarWithdrawBatchTx:()=>g.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>g.buildStellarWithdrawTx,buildTx:()=>g.buildTx,decodeStellarLendingEvent:()=>g.decodeStellarLendingEvent,encodeAssetConfigRaw:()=>g.encodeAssetConfigRaw,encodeInterestRateModel:()=>g.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>g.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>g.encodeMarketParamsRaw,encodeOracleSourceConfigInput:()=>g.encodeOracleSourceConfigInput,encodePositionLimits:()=>g.encodePositionLimits,encodeStrategyPayloadToRouteXdr:()=>g.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>g.extractEventOrder,getStellarAccountPositions:()=>g.getStellarAccountPositions,getStellarAggregatorQuote:()=>g.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>g.getStellarAggregatorRouter,getStellarAsset:()=>g.getStellarAsset,getStellarAssetGraph:()=>g.getStellarAssetGraph,getStellarAssetMarkets:()=>g.getStellarAssetMarkets,getStellarGovernance:()=>g.getStellarGovernance,getStellarGovernanceProposals:()=>g.getStellarGovernanceProposals,getStellarHub:()=>g.getStellarHub,getStellarHubGraph:()=>g.getStellarHubGraph,getStellarLendingController:()=>g.getStellarLendingController,getStellarQuoteTokens:()=>g.getStellarQuoteTokens,getStellarReserve:()=>g.getStellarReserve,getStellarReserveGraph:()=>g.getStellarReserveGraph,getStellarReserveHolders:()=>g.getStellarReserveHolders,getStellarSpoke:()=>g.getStellarSpoke,getStellarSpokeGraph:()=>g.getStellarSpokeGraph,getStellarUserPositions:()=>g.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>g.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>g.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>g.mapQuoteResponseToStrategySwap,mapStellarPositionActivityType:()=>g.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>g.prepareStellarBuiltTx,prepareStellarTxXdr:()=>g.prepareStellarTxXdr,stellarLendingDispatchKey:()=>g.stellarLendingDispatchKey,stellarLendingRead:()=>g.stellarLendingRead,syntheticEventOrder:()=>g.syntheticEventOrder,tagStellarInvokedContractError:()=>g.tagStellarInvokedContractError,toBase64Xdr:()=>g.toBase64Xdr,toStellarPositionMode:()=>g.toStellarPositionMode});const u="https://api.xoxno.com",n="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=u,...o}={}){this.apiUrl=t??{[l.MAINNET]:u,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=o,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:n,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:n,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:u,debug:n,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,y=p?.Authorization,b="Bearer undefined"===y?void 0:y,S={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...b?{Authorization:b}:{}},T=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),g=`${this.apiUrl}${e}${T.length?`?${T}`:""}`,{revalidate:f,...m}=r??{},{revalidate:x,..._}=i??{},v="GET"!==d||b?void 0:x??f,h="GET"!==d||b||v?void 0:l??u,q={...a,...c,method:d,...Object.keys(S).length?{headers:S}:{},cache:h,next:{...m,..._,revalidate:v}};(s??n)&&console.debug("SDK fetch: ",g,q);const A=await fetch(g,q).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${g}: ${e.message}`),{cause:e});throw e})),w=await A.text();if(!A.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[g,A.status,A.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class y extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const b=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),S={"/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/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/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:{}}}},T=["PATCH","POST","DELETE","PUT"];var g=o(454);const f=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),m=()=>({static:{},params:{},leaves:[]});function x(e,t,o,r){const{input:u,output:n,...a}=t,i=async(t={})=>{const u={...o,...t},n=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(u).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=u.address;if(!b(e))throw new y(e)}if(s){const e=u.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:S,auth:T,method:g,headers:f,cache:m,next:x,debug:_,continuationToken:v,...h}=d,q=T?`Bearer ${T}`:void 0,A={...f,...q?{Authorization:q}:{},...v?{"X-Continuation-Token":String(v)}:{}},w={...x,tags:[...x?.tags??[],n]};return r.fetchWithTimeout(n,{method:g,params:h,body:S,headers:A,cache:m,debug:_,...w?{next:w}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))T.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function _(e){const t=function(){const e=m();for(const[t,o]of Object.entries(S)){const r=t.split("/").filter(Boolean);let u=e;for(const e of r)if(e.startsWith(":")){const t=f(e.slice(1));u=u.params[t]||=m()}else{const t=f(e);u=u.static[t]||=m()}u.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const u=t.leaves.length,n=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===u&&n+a>0){const{rawPath:o,def:u}=t.leaves[0];i=x(o,u,r,e)}else{i={};for(const{rawPath:o,def:u}of t.leaves)i[f(o.split("/").pop().replace(/^:/,""))]=x(o,u,r,e)}for(const[e,u]of Object.entries(t.static)){const t=o(u,r);let n=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const o=t[e],r=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===o.length||(Object.assign(o,r),n=o)}void 0===i[e]?i[e]=n:"function"==typeof i[e]?Object.assign(i[e],n):"function"==typeof n?(Object.assign(n,i[e]),i[e]=n):Object.assign(i[e],n)}for(const[e,u]of Object.entries(t.params)){const t=t=>{const n=o(u,{...r,[e]:t});if(n&&"object"==typeof n&&1===Object.keys(n).length&&e in n&&"function"==typeof n[e]){const t=n[e],o=(...e)=>t(...e);return Object.assign(o,t)}return n};if(i[e]){const o=i[e];i[e]=e=>({...o(e),...t(e)})}else i[e]=t}return i};return o(t,{})}module.exports=r})();
|