@xoxno/sdk-js 1.0.189 → 1.0.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/cjs/sdk/stellar/governance.d.ts +11 -10
- package/dist/cjs/sdk/stellar/lending-read.d.ts +4 -1
- package/dist/cjs/sdk/swagger.d.ts +5 -1
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/governance.d.ts +11 -10
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/sdk/stellar/lending-read.d.ts +4 -1
- package/dist/sdk/swagger.d.ts +5 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>o,STELLAR_GOVERNANCE:()=>a,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>tt,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>Rr,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>s,STELLAR_SOROBAN_RPC_URL:()=>n,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Er,XOXNO_LENDING_STELLAR_TICKER:()=>Ar,buildSameTokenRepaySwapSteps:()=>Kr,buildStellarAcceptOwnershipTx:()=>Ge,buildStellarAddRewardsTx:()=>Je,buildStellarApproveTokenTx:()=>We,buildStellarBatchSwapTx:()=>Vr,buildStellarBorrowBatchTx:()=>C,buildStellarBorrowTx:()=>q,buildStellarCctpForwardTx:()=>Yr,buildStellarClaimRevenueTx:()=>Ye,buildStellarCreateLiquidityPoolTx:()=>Ke,buildStellarExecuteStrategyTx:()=>Dr,buildStellarFlashLoanTx:()=>F,buildStellarGovernanceAddSpokeImmediateTx:()=>rr,buildStellarGovernanceCreateHubImmediateTx:()=>tr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>jt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Kt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Zt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Yt,buildStellarGovernanceExecuteTx:()=>Ht,buildStellarGovernanceExecuteUpdateDelayTx:()=>Qt,buildStellarGovernancePauseTx:()=>ar,buildStellarGovernanceRevokeRoleImmediateTx:()=>or,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>er,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Jt,buildStellarGovernanceUnpauseTx:()=>nr,buildStellarGrantRoleTx:()=>Ne,buildStellarLendingIdentifier:()=>Pr,buildStellarLiquidateTx:()=>M,buildStellarMigrateFromBlendTx:()=>X,buildStellarMigrateTx:()=>Oe,buildStellarMultiplyTx:()=>H,buildStellarPauseTx:()=>Be,buildStellarProposeAddAssetToSpokeTx:()=>vt,buildStellarProposeAddSpokeTx:()=>Tt,buildStellarProposeApproveBlendPoolTx:()=>Ot,buildStellarProposeApproveTokenTx:()=>Et,buildStellarProposeConfigureMarketOracleTx:()=>Dt,buildStellarProposeCreateHubTx:()=>wt,buildStellarProposeCreateLiquidityPoolTx:()=>Lt,buildStellarProposeDeployPoolTx:()=>$t,buildStellarProposeEditAssetInSpokeTx:()=>xt,buildStellarProposeEditOracleToleranceTx:()=>Vt,buildStellarProposeGovernanceUpgradeTx:()=>Wt,buildStellarProposeGrantGovernanceRoleTx:()=>Mt,buildStellarProposeMigrateControllerTx:()=>Ct,buildStellarProposeRemoveAssetFromSpokeTx:()=>kt,buildStellarProposeRemoveSpokeTx:()=>yt,buildStellarProposeRevokeBlendPoolTx:()=>Bt,buildStellarProposeRevokeGovernanceRoleTx:()=>Ft,buildStellarProposeRevokeTokenTx:()=>Pt,buildStellarProposeSetAccumulatorTx:()=>bt,buildStellarProposeSetAggregatorTx:()=>St,buildStellarProposeSetMinBorrowCollatTx:()=>At,buildStellarProposeSetPoolTemplateTx:()=>_t,buildStellarProposeSetPositionLimitsTx:()=>gt,buildStellarProposeSetPositionManagerTx:()=>It,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Rt,buildStellarProposeTransferCtrlOwnershipTx:()=>qt,buildStellarProposeTransferGovOwnTx:()=>Xt,buildStellarProposeUpdateDelayTx:()=>zt,buildStellarProposeUpgradeControllerTx:()=>Gt,buildStellarProposeUpgradePoolParamsTx:()=>Nt,buildStellarProposeUpgradePoolTx:()=>Ut,buildStellarRenewAccountTx:()=>Qe,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>K,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>$e,buildStellarRevokeTokenTx:()=>ze,buildStellarSetAccumulatorTx:()=>qe,buildStellarSetAggregatorTx:()=>Ce,buildStellarSetLiquidityPoolTemplateTx:()=>De,buildStellarSetMarketOracleConfigTx:()=>Me,buildStellarSetOracleSanityBoundsTx:()=>He,buildStellarSetOracleToleranceTx:()=>Fe,buildStellarSetPositionLimitsTx:()=>Ve,buildStellarSetSpokeAssetFlagsTx:()=>Xe,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>G,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>j,buildStellarTransferOwnershipTx:()=>Ue,buildStellarUnpauseTx:()=>Le,buildStellarUpdateAccountThresholdTx:()=>et,buildStellarUpdateIndexesTx:()=>je,buildStellarUpgradeControllerTx:()=>Pe,buildStellarUpgradeLiquidityPoolParamsTx:()=>Ze,buildStellarWithdrawBatchTx:()=>D,buildStellarWithdrawTx:()=>V,buildTx:()=>$,decodeStellarLendingEvent:()=>Ir,encodeInterestRateModel:()=>ve,encodeMarketOracleConfigInput:()=>Ee,encodeMarketParamsRaw:()=>xe,encodeOracleSourceConfigInput:()=>Ae,encodePositionLimits:()=>ke,encodeStrategyPayloadToRouteXdr:()=>qr,extractEventOrder:()=>Or,getStellarAccountPositions:()=>fe,getStellarAggregatorQuote:()=>Ur,getStellarAggregatorRouter:()=>u,getStellarAsset:()=>le,getStellarAssetGraph:()=>Se,getStellarAssetMarkets:()=>ue,getStellarAssetPage:()=>ie,getStellarAssets:()=>te,getStellarGovernance:()=>c,getStellarGovernanceProposals:()=>he,getStellarHub:()=>ce,getStellarHubGraph:()=>be,getStellarHubs:()=>re,getStellarLendingContext:()=>ee,getStellarLendingController:()=>i,getStellarQuoteTokens:()=>Gr,getStellarReserve:()=>ne,getStellarReserveGraph:()=>ge,getStellarReserveHolders:()=>se,getStellarReserves:()=>ae,getStellarSpoke:()=>de,getStellarSpokeGraph:()=>_e,getStellarSpokes:()=>oe,getStellarUserActivity:()=>me,getStellarUserPositions:()=>pe,mapQuoteResponseToAggregatorSwap:()=>Mr,mapQuoteResponseToStrategyPayload:()=>Wr,mapQuoteResponseToStrategySwap:()=>zr,mapSorobanError:()=>eo,mapStellarPositionActivityType:()=>Lr,prepareStellarBuiltTx:()=>jr,prepareStellarTxXdr:()=>Hr,stellarLendingDispatchKey:()=>ir,stellarLendingRead:()=>we,syntheticEventOrder:()=>Br,tagStellarInvokedContractError:()=>Xr,toBase64Xdr:()=>sr,toStellarPositionMode:()=>Qr});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},o={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},a={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},n={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},s={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 i(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 u(e){const t=o[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 c(e){const t=a[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const d=require("@stellar/stellar-sdk"),p=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],m=e=>new d.Address(e).toScVal(),f=e=>new d.ScInt(e).toI128(),h=e=>d.xdr.ScVal.scvU32(e),S=e=>new d.ScInt("string"==typeof e?e:e.toString()).toU64(),b=e=>d.xdr.ScVal.scvBool(e),_=e=>d.xdr.ScVal.scvString(e),g=e=>d.xdr.ScVal.scvSymbol(e),w=()=>d.xdr.ScVal.scvVoid(),T=e=>d.xdr.ScVal.scvVec(e),y=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return d.xdr.ScVal.scvBytes(o)},v=(e,t)=>null==e?w():t(e),x=e=>d.xdr.ScVal.scvVec(e.map((e=>{return t=e.token,r=e.amount,d.xdr.ScVal.scvVec([m(t),f(r)]);var t,r}))),k=(e,t)=>A({asset:m(t),hub_id:h(e)}),R=(e,t,r)=>d.xdr.ScVal.scvVec([k(e,t),f(r)]),I=e=>d.xdr.ScVal.scvVec(e.map((e=>R(e.hubId,e.asset,e.amount)))),A=e=>{const t=Object.keys(e).sort().map((t=>new d.xdr.ScMapEntry({key:g(t),val:e[t]})));return d.xdr.ScVal.scvMap(t)},E=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return A({amount_out:f(e.amountOut),pool:m(e.pool),token_in:m(e.tokenIn),token_out:m(e.tokenOut),venue:(t=e.venue,d.xdr.ScVal.scvVec([g(t)]))});var t}));return A({hops:d.xdr.ScVal.scvVec(t),split_ppm:h(e.splitPpm)})}));return A({paths:d.xdr.ScVal.scvVec(t),referral_id:S(e.referralId??0),token_in:m(e.tokenIn),token_out:m(e.tokenOut),total_min_out:f(e.totalMinOut)})},P=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 d.xdr.ScVal.scvBytes(t)},O=()=>d.xdr.ScVal.scvBytes(Buffer.alloc(0)),B=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},L=e=>{if("string"==typeof e)return P(B(e));if(e instanceof Uint8Array)return 0===e.length?O():P(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?P(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(B(e.bytes)):0===e.bytes.length?O():P(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!p.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),d.xdr.ScVal.scvBytes(Buffer.from(E(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},N=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return d.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return d.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function $(e,t,r){const o=e.controllerAddress??i(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return $(e,"supply",[m(e.caller),S(r),h(o),I([...t.assets])])}function G(e,t){return U(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function C(e,t){return $(e,"borrow",[m(e.caller),S(t.accountNonce),I([...t.borrows]),v(t.to,m)])}function q(e,t){return C(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return $(e,"withdraw",[m(e.caller),S(t.accountNonce),I([...t.withdrawals]),v(t.to,m)])}function V(e,t){return D(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return $(e,"repay",[m(e.caller),S(t.accountNonce),I([...t.payments])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function M(e,t){return $(e,"liquidate",[m(e.caller),S(t.accountNonce),I([...t.debtPayments])])}function F(e,t){return $(e,"flash_loan",[m(e.caller),k(t.hubId,t.asset),f(t.amount),m(t.receiver),N(t.data)])}function X(e,t){return $(e,"migrate_from_blend",[m(e.caller),S(t.accountId),h(t.spokeId),h(t.hubId),m(t.blendPool),T(t.collateralTokens.map(m)),T(t.supplyTokens.map(m)),x(t.debtCaps.map((e=>({token:e.token,amount:e.cap}))))])}function H(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return $(e,"multiply",[m(e.caller),S(r),h(o),k(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),k(t.debt.hubId,t.debt.asset),h(t.mode),L(t.steps),v(t.initialPayment,(e=>R(e.hubId,e.asset,e.amount))),v(t.convertSwap,L)])}function j(e,t){return $(e,"swap_debt",[m(e.caller),S(t.accountNonce),k(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),k(t.newDebt.hubId,t.newDebt.asset),L(t.steps)])}function Q(e,t){return $(e,"swap_collateral",[m(e.caller),S(t.accountNonce),k(t.current.hubId,t.current.asset),f(t.fromAmount),k(t.newCollateral.hubId,t.newCollateral.asset),L(t.steps)])}function K(e,t){return $(e,"repay_debt_with_collateral",[m(e.caller),S(t.accountNonce),k(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),k(t.debt.hubId,t.debt.asset),L(t.steps),b(t.closePosition)])}const Z="/stellar-lending",Y=25,J=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${Z}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),re=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),oe=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),ae=(e,t={},r)=>{const{hubId:o,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${Z}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ne=(e,t,r,o,a)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${J(o)}`,a),se=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${J(o)}/holders`,{...n,params:{side:a}}),le=(e,t,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}`,r),ie=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/page`,{...o,params:{...r}}),ue=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/markets`,{...o,params:{side:r}}),ce=(e,t,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,r),de=(e,t,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,r),pe=(e,t,r)=>e.fetchWithTimeout(`${Z}/users/${J(t)}/positions`,r),me=(e,t,r={},o)=>{const{skip:a,top:n}=r;return e.fetchWithTimeout(`${Z}/users/${J(t)}/activity`,{...o,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},fe=(e,t,r)=>e.fetchWithTimeout(`${Z}/accounts/${J(t)}/positions`,r),he=(e,t={},r)=>{const{top:o=Y,continuationToken:a}=t;return e.fetchWithTimeout(`${Z}/governance/proposals`,{...r,params:{top:o,...a?{continuationToken:a}:{}}})},Se=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/graph`,{...o,params:{...r}}),be=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...o,params:{...r}}),_e=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...o,params:{...r}}),ge=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${J(o)}/graph`,{...n,params:{...a}}),we=e=>({context:t=>ee(e,t),assets:t=>te(e,t),hubs:t=>re(e,t),spokes:t=>oe(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?ae(e,t,r):ae(e,{},t);var o},reserve:(t,r,o,a)=>ne(e,t,r,o,a),reserveHolders:(t,r,o,a,n)=>se(e,t,r,o,a,n),asset:(t,r)=>le(e,t,r),assetMarkets:(t,r,o)=>ue(e,t,r,o),hub:(t,r)=>ce(e,t,r),spoke:(t,r)=>de(e,t,r),userPositions:(t,r)=>pe(e,t,r),userActivity:(t,r,o)=>me(e,t,r,o),accountPositions:(t,r)=>fe(e,t,r),governanceProposals:(t,r)=>he(e,t,r),assetGraph:(t,r,o)=>Se(e,t,r,o),hubGraph:(t,r,o)=>be(e,t,r,o),spokeGraph:(t,r,o)=>_e(e,t,r,o),reserveGraph:(t,r,o,a,n)=>ge(e,t,r,o,a,n)}),Te={Single:0,PrimaryWithAnchor:1},ye="RedStonePriceFeed",ve=e=>A({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),xe=e=>A({asset_decimals:h(e.assetDecimals),asset_id:m(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:b(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),ke=e=>A({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),Re=e=>{const t=e.kind;switch(t){case"Stellar":return T([g("Stellar"),m(e.value)]);case"Symbol":return T([g("Symbol"),g(e.value)]);case"String":return T([g("String"),_(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Ie=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return T([g("Twap"),h(t)])}return T([g("Spot")])},Ae=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return T([g("Reflector"),A({asset:Re(e.asset),contract:m(e.contract),read_mode:Ie(e.readMode,e.twapRecords)})])}if(t===ye||"XoxnoPriceFeed"===t){const r=t===ye?"RedStone":"Xoxno";if("string"!=typeof e.feedId)throw new Error(`Stellar builder: ${r} oracle source requires \`feedId\``);if("number"!=typeof e.maxStaleSeconds)throw new Error(`Stellar builder: ${r} oracle source requires \`maxStaleSeconds\``);return T([g(r),A({contract:m(e.contract),feed_id:_(e.feedId),max_stale_seconds:S(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Ee=e=>{const t=Te[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return A({anchor:(r=e.anchor,T(null==r?[g("None")]:[g("Some"),Ae(r)])),max_price_stale_seconds:S(e.maxPriceStaleSeconds),max_sanity_price_wad:f(e.maxSanityPriceWad),min_sanity_price_wad:f(e.minSanityPriceWad),primary:Ae(e.primary),strategy:h(t),tolerance_bps:h(e.toleranceBps)});var r};function Pe(e,t){return $(e,"upgrade",[y(t.wasmHash)])}function Oe(e,t){return $(e,"migrate",[h(t.newVersion)])}function Be(e){return $(e,"pause",[])}function Le(e){return $(e,"unpause",[])}function Ne(e,t){return $(e,"grant_role",[m(t.account),g(t.role)])}function $e(e,t){return $(e,"revoke_role",[m(t.account),g(t.role)])}function Ue(e,t){return $(e,"transfer_ownership",[m(t.newOwner),h(t.liveUntilLedger)])}function Ge(e){return $(e,"accept_ownership",[])}function Ce(e,t){return $(e,"set_aggregator",[m(t.aggregator)])}function qe(e,t){return $(e,"set_accumulator",[m(t.accumulator)])}function De(e,t){return $(e,"set_liquidity_pool_template",[y(t.wasmHash)])}function Ve(e,t){return $(e,"set_position_limits",[ke(t)])}function We(e,t){return $(e,"approve_token",[m(t.token)])}function ze(e,t){return $(e,"revoke_token",[m(t.token)])}function Me(e,t){return $(e,"set_market_oracle_config",[k(t.hubId,t.asset),Ee(t.config)])}function Fe(e,t){return $(e,"set_oracle_tolerance",[m(t.asset),A({lower_ratio_bps:h(t.lowerRatioBps),upper_ratio_bps:h(t.upperRatioBps)})])}function Xe(e,t){return $(e,"set_spoke_asset_flags",[h(t.spokeId),k(t.hubId,t.asset),b(t.paused),b(t.frozen)])}function He(e,t){return $(e,"set_oracle_sanity_bounds",[m(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function je(e,t){return $(e,"update_indexes",[m(e.caller),T(t.assets.map((e=>k(e.hubId,e.asset))))])}function Qe(e,t){return $(e,"renew_account",[m(e.caller),S(t.accountNonce)])}function Ke(e,t){return $(e,"create_liquidity_pool",[h(t.hubId),m(t.asset),xe(t.params)])}function Ze(e,t){return $(e,"upgrade_liquidity_pool_params",[k(t.hubId,t.asset),ve(t.params)])}function Ye(e,t){return $(e,"claim_revenue",[m(e.caller),T(t.assets.map((e=>k(e.hubId,e.asset))))])}function Je(e,t){return $(e,"add_rewards",[m(e.caller),I(t.rewards)])}function et(e,t){return $(e,"update_account_threshold",[m(e.caller),b(t.hasRisks),T(t.accountNonces.map((e=>S(e))))])}const tt="00".repeat(32),rt=e=>{if("string"==typeof e)return y(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 d.xdr.ScVal.scvBytes(t)},ot=(e,...t)=>T([g(e),...t]),at=e=>A({asset:m(e.asset),hub_id:h(e.hubId),params:xe(e.params)}),nt=e=>A({hub_asset:k(e.hubId,e.asset),params:ve(e.params)}),st=e=>A({new_owner:m(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),lt=e=>A({cfg:Ee(e.config),hub_asset:k(e.hubId,e.asset)}),it=e=>A({asset:m(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:b(e.canBorrow),can_collateral:b(e.canCollateral),frozen:b(e.frozen),hub_id:h(e.hubId),paused:b(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),oracle_override:T([g("None")]),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),ut=e=>A({hub_asset:k(e.hubId,e.asset),spoke_id:h(e.spokeId)}),ct=e=>A({hf_for_max_bonus_wad:f(e.hfForMaxBonusWad),liquidation_bonus_factor_bps:h(e.liquidationBonusFactorBps),spoke_id:h(e.spokeId),target_hf_wad:f(e.targetHfWad)}),dt=e=>A({asset:m(e.asset),tolerance:h(e.tolerance)}),pt=e=>A({account:m(e.account),role:g(e.role)});function mt(e,t,r){const o=e.governanceAddress??c(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ft=(e,t,r)=>mt(e,"propose",[m(e.caller),t,rt(r)]),ht=(e,t,r)=>mt(e,"execute_self",[w(),t,rt(r)]);function St(e,t,r){return ft(e,ot("SetAggregator",m(t.aggregator)),r)}function bt(e,t,r){return ft(e,ot("SetAccumulator",m(t.accumulator)),r)}function _t(e,t,r){return ft(e,ot("SetLiquidityPoolTemplate",y(t.wasmHash)),r)}function gt(e,t,r){return ft(e,ot("SetPositionLimits",ke(t)),r)}function wt(e,t){return ft(e,ot("CreateHub"),t)}function Tt(e,t){return ft(e,ot("AddSpoke"),t)}function yt(e,t,r){return ft(e,ot("RemoveSpoke",h(t.spokeId)),r)}function vt(e,t,r){return ft(e,ot("AddAssetToSpoke",it(t)),r)}function xt(e,t,r){return ft(e,ot("EditAssetInSpoke",it(t)),r)}function kt(e,t,r){return ft(e,ot("RemoveAssetFromSpoke",ut(t)),r)}function Rt(e,t,r){return ft(e,ot("SetSpokeLiquidationCurve",ct(t)),r)}function It(e,t,r){return ft(e,ot("SetPositionManager",m(t.manager),b(t.isActive)),r)}function At(e,t,r){return ft(e,ot("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function Et(e,t,r){return ft(e,ot("ApproveToken",m(t.token)),r)}function Pt(e,t,r){return ft(e,ot("RevokeToken",m(t.token)),r)}function Ot(e,t,r){return ft(e,ot("ApproveBlendPool",m(t.pool)),r)}function Bt(e,t,r){return ft(e,ot("RevokeBlendPool",m(t.pool)),r)}function Lt(e,t,r){return ft(e,ot("CreateLiquidityPool",at(t)),r)}function Nt(e,t,r){return ft(e,ot("UpgradeLiquidityPoolParams",nt(t)),r)}function $t(e,t){return ft(e,ot("DeployPool"),t)}function Ut(e,t,r){return ft(e,ot("UpgradePool",y(t.wasmHash)),r)}function Gt(e,t,r){return ft(e,ot("UpgradeController",y(t.wasmHash)),r)}function Ct(e,t,r){return ft(e,ot("MigrateController",h(t.newVersion)),r)}function qt(e,t,r){return ft(e,ot("TransferCtrlOwnership",st(t)),r)}function Dt(e,t,r){return ft(e,ot("ConfigureMarketOracle",lt(t)),r)}function Vt(e,t,r){return ft(e,ot("EditOracleTolerance",dt(t)),r)}function Wt(e,t,r){return ft(e,ot("UpgradeGov",y(t.wasmHash)),r)}function zt(e,t,r){return ft(e,ot("UpdateGovDelay",h(t.newDelay)),r)}function Mt(e,t,r){return ft(e,ot("GrantGovRole",pt(t)),r)}function Ft(e,t,r){return ft(e,ot("RevokeGovRole",pt(t)),r)}function Xt(e,t,r){return ft(e,ot("TransferGovOwnership",st(t)),r)}function Ht(e,t){const r=T(t.argsXdr.map((e=>d.xdr.ScVal.fromXDR(e,"base64")))),o=rt(t.predecessor??tt);return mt(e,"execute",[w(),m(t.target),g(t.functionName),r,o,rt(t.salt)])}function jt(e,t,r){return ht(e,ot("UpgradeGov",y(t.wasmHash)),r)}function Qt(e,t,r){return ht(e,ot("UpdateGovDelay",h(t.newDelay)),r)}function Kt(e,t,r){return ht(e,ot("GrantGovRole",pt(t)),r)}function Zt(e,t,r){return ht(e,ot("RevokeGovRole",pt(t)),r)}function Yt(e,t,r){return ht(e,ot("TransferGovOwnership",st(t)),r)}function Jt(e,t){return mt(e,"set_spoke_asset_flags",[m(e.caller),h(t.spokeId),k(t.hubId,t.asset),b(t.paused),b(t.frozen)])}function er(e,t){return mt(e,"set_oracle_sanity_bounds",[m(e.caller),m(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function tr(e){return mt(e,"create_hub",[m(e.caller)])}function rr(e){return mt(e,"add_spoke",[m(e.caller)])}function or(e,t){return mt(e,"revoke_role_immediate",[m(t.account),g(t.role)])}function ar(e){return mt(e,"pause",[])}function nr(e){return mt(e,"unpause",[])}const sr=e=>e.toXDR("base64"),lr=e=>d.xdr.ScVal.fromXDR(e,"base64"),ir=e=>e.map((e=>String((0,d.scValToNative)(lr(e))))).join(":"),ur=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),cr=e=>Number(e),dr=e=>String(e),pr=e=>null==e?void 0:ur(e),mr=e=>null==e?void 0:dr(e),fr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),hr=["None","Multiply","Long","Short"],Sr=["Single","PrimaryWithAnchor"],br=["ReflectorSep40","RedStonePriceFeed"],_r=["Spot","Twap"],gr=["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"],wr=e=>Array.isArray(e)?e:[],Tr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],gr[cr(o)]??ur(o)),positionType:t,hubId:cr(e[1]),asset:dr(e[2]),scaledAmountRay:ur(e[3]),indexRay:ur(e[4]),amount:ur(e[5]),liquidationThresholdBps:r?void 0:cr(e[6]),liquidationBonusBps:r?void 0:cr(e[7]),loanToValueBps:r?void 0:cr(e[8]),liquidationFeesBps:r?void 0:cr(e[9])};var o},yr=e=>{return{owner:dr(e[0]),spokeId:cr(e[1]),mode:(t=e[2],hr[cr(t)]??"None")};var t},vr=(e,t)=>{const r=_r[cr(e[`${t}_read_mode`])]??"Spot",o=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=o?{kind:"Stellar",value:dr(o)}:null!=a?{kind:"Symbol",value:dr(a)}:void 0;return{provider:br[cr(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:dr(e[`${t}_contract`]),asset:n,feedId:mr(e[`${t}_feed_id`]),readMode:r,twapRecords:"Twap"===r?cr(e[`${t}_twap_records`]):void 0,decimals:cr(e[`${t}_decimals`]),resolutionSeconds:cr(e[`${t}_resolution_seconds`]),maxStaleSeconds:cr(e[`${t}_max_stale_seconds`])}},xr=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:dr(e.base_token_id),quoteTokenId:dr(e.quote_token_id),tolerance:{upperRatio:cr(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:cr(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:cr(e.asset_decimals),maxPriceStaleSeconds:cr(e.max_price_stale_seconds),strategy:Sr[cr(e.strategy)]??"Single",primary:vr(e,"primary"),anchor:t?vr(e,"anchor"):void 0,primaryQuoteToken:mr(e.primary_quote_token),anchorQuoteToken:mr(e.anchor_quote_token),minSanityPriceWad:pr(e.min_sanity_price_wad),maxSanityPriceWad:pr(e.max_sanity_price_wad)}},kr={"market:create":e=>({topic:"market:create",data:{hubId:cr(e.hub_id),baseAsset:dr(e.base_asset),maxBorrowRate:ur(e.max_borrow_rate),baseBorrowRate:ur(e.base_borrow_rate),slope1:ur(e.slope1),slope2:ur(e.slope2),slope3:ur(e.slope3),midUtilization:ur(e.mid_utilization),optimalUtilization:ur(e.optimal_utilization),maxUtilization:ur(e.max_utilization),reserveFactor:cr(e.reserve_factor),marketAddress:dr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:dr(e.asset),maxBorrowRateRay:ur(e.max_borrow_rate),baseBorrowRateRay:ur(e.base_borrow_rate),slope1Ray:ur(e.slope1),slope2Ray:ur(e.slope2),slope3Ray:ur(e.slope3),midUtilizationRay:ur(e.mid_utilization),optimalUtilizationRay:ur(e.optimal_utilization),maxUtilizationRay:ur(e.max_utilization),reserveFactorBps:cr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:wr(e).map((e=>{return t=wr(e),{hubId:cr(t[0]),asset:dr(t[1]),timestamp:cr(t[2]),supplyIndexRay:ur(t[3]),borrowIndexRay:ur(t[4]),cash:ur(t[5]),suppliedRay:ur(t[6]),borrowedRay:ur(t[7]),revenueRay:ur(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:wr(e).map((e=>{const t=e;return{hubId:cr(t.hub_id),asset:dr(t.asset),params:(r=t.params,{maxBorrowRateRay:ur(r.max_borrow_rate),baseBorrowRateRay:ur(r.base_borrow_rate),slope1Ray:ur(r.slope1),slope2Ray:ur(r.slope2),slope3Ray:ur(r.slope3),midUtilizationRay:ur(r.mid_utilization),optimalUtilizationRay:ur(r.optimal_utilization),maxUtilizationRay:ur(r.max_utilization),reserveFactorBps:cr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:cr(r.flashloan_fee),assetId:dr(r.asset_id),assetDecimals:cr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=wr(e);return{topic:"position:batch_update",data:{accountId:ur(t[0]),accountAttributes:yr(wr(t[1])),updates:[...wr(t[2]).map((e=>Tr(wr(e),"Deposit"))),...wr(t[3]).map((e=>Tr(wr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:cr(e.hub_id),asset:dr(e.asset),receiver:dr(e.receiver),caller:dr(e.caller),amount:ur(e.amount),fee:ur(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:dr(e.asset),oracle:xr(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:dr(e.liquidator),accountId:ur(e.account_id),repaidUsdWad:ur(e.repaid_usd_wad),bonusBps:ur(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:ur(e.account_id),totalBorrowUsdWad:ur(e.total_borrow_usd_wad),totalCollateralUsdWad:ur(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:dr(e.token),amount:ur(e.amount),usdValueWad:ur(e.usd_value_wad),accountId:ur(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:cr(e.hub_id),asset:dr(e.asset),amount:ur(e.amount),fee:ur(e.fee),amountSent:ur(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:fr(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:dr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:dr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:fr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:cr(e.max_supply_positions),maxBorrowPositions:cr(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:dr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:cr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:ur(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:ur(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:cr(t.liquidation_bonus_factor_bps)}}}},Rr=Object.freeze(Object.keys(kr));function Ir(e,t){const r=ir(e),o=kr[r];return o?o((0,d.scValToNative)(lr(t))):null}const Ar="XLENDXLM-a7c9f3",Er=1e4;function Pr(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${Ar}-${r}`}function Or(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Br(e,t=0){return e*Er+t}function Lr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Nr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},$r=e=>e.baseUrl??s[e.network];async function Ur(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=Nr($r(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function Gr(e){const t=Nr($r(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Cr=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,qr=e=>E(e).toXDR("base64");function Dr(e,t){const r=e.routerAddress??u(e.network),o=new d.Contract(r),a=new d.Account(e.caller,e.sourceSequence),n=L(Cr(t,e.referralId));return{xdr:new d.TransactionBuilder(a,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",m(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Vr(e,t){return Dr(e,t)}function Wr(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(Fr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Fr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function zr(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Wr(e,t)}const Mr=Wr,Fr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Xr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Hr(e,t,r){const o=d.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Xr(r.invokedContractId,e);throw e}}async function jr(e,t,r){return Hr(e,t.xdr,r)}function Qr(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 Kr(e,t){return new Uint8Array(0)}const Zr=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 Yr(e){const t=new d.Account(e.caller,e.sourceSequence),r=new d.Contract(e.forwarderAddress).call("mint_and_forward",d.xdr.ScVal.scvBytes(Zr(e.message)),d.xdr.ScVal.scvBytes(Zr(e.attestation)));return{xdr:new d.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Jr={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function eo(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=Jr[r];return o?{code:r,...o}:null}module.exports=t})();
|
|
1
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>o,STELLAR_GOVERNANCE:()=>a,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>rt,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>Ir,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>s,STELLAR_SOROBAN_RPC_URL:()=>n,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Pr,XOXNO_LENDING_STELLAR_TICKER:()=>Er,buildSameTokenRepaySwapSteps:()=>Zr,buildStellarAcceptOwnershipTx:()=>Ce,buildStellarAddRewardsTx:()=>et,buildStellarApproveTokenTx:()=>ze,buildStellarBatchSwapTx:()=>Vr,buildStellarBorrowBatchTx:()=>C,buildStellarBorrowTx:()=>q,buildStellarCctpForwardTx:()=>Jr,buildStellarClaimRevenueTx:()=>Je,buildStellarCreateLiquidityPoolTx:()=>Ze,buildStellarExecuteStrategyTx:()=>Wr,buildStellarFlashLoanTx:()=>F,buildStellarGovernanceAddSpokeImmediateTx:()=>or,buildStellarGovernanceCreateHubImmediateTx:()=>rr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Qt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Zt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Yt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Jt,buildStellarGovernanceExecuteTx:()=>jt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Kt,buildStellarGovernancePauseTx:()=>nr,buildStellarGovernanceRevokeRoleImmediateTx:()=>ar,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>tr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>er,buildStellarGrantRoleTx:()=>Ne,buildStellarLendingIdentifier:()=>Or,buildStellarLiquidateTx:()=>M,buildStellarMigrateFromBlendTx:()=>X,buildStellarMigrateTx:()=>Be,buildStellarMultiplyTx:()=>H,buildStellarPauseTx:()=>Le,buildStellarProposeAddAssetToSpokeTx:()=>xt,buildStellarProposeAddSpokeTx:()=>yt,buildStellarProposeApproveBlendPoolTx:()=>Bt,buildStellarProposeApproveTokenTx:()=>Pt,buildStellarProposeConfigureMarketOracleTx:()=>Wt,buildStellarProposeCreateHubTx:()=>Tt,buildStellarProposeCreateLiquidityPoolTx:()=>$t,buildStellarProposeDeployPoolTx:()=>Ut,buildStellarProposeEditAssetInSpokeTx:()=>kt,buildStellarProposeEditOracleToleranceTx:()=>Vt,buildStellarProposeGovernanceUpgradeTx:()=>zt,buildStellarProposeGrantGovernanceRoleTx:()=>Ft,buildStellarProposeMigrateControllerTx:()=>qt,buildStellarProposeRemoveAssetFromSpokeTx:()=>Rt,buildStellarProposeRemoveSpokeTx:()=>vt,buildStellarProposeRevokeBlendPoolTx:()=>Lt,buildStellarProposeRevokeGovernanceRoleTx:()=>Xt,buildStellarProposeRevokeTokenTx:()=>Ot,buildStellarProposeSetAccumulatorTx:()=>_t,buildStellarProposeSetAggregatorTx:()=>bt,buildStellarProposeSetMinBorrowCollatTx:()=>Et,buildStellarProposeSetPoolTemplateTx:()=>gt,buildStellarProposeSetPositionLimitsTx:()=>wt,buildStellarProposeSetPositionManagerTx:()=>At,buildStellarProposeSetSpokeLiquidationCurveTx:()=>It,buildStellarProposeTransferCtrlOwnershipTx:()=>Dt,buildStellarProposeTransferGovOwnTx:()=>Ht,buildStellarProposeUnpauseTx:()=>sr,buildStellarProposeUpdateDelayTx:()=>Mt,buildStellarProposeUpgradeControllerTx:()=>Ct,buildStellarProposeUpgradePoolParamsTx:()=>Nt,buildStellarProposeUpgradePoolTx:()=>Gt,buildStellarRenewAccountTx:()=>Ke,buildStellarRepayBatchTx:()=>V,buildStellarRepayDebtWithCollateralTx:()=>K,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Ue,buildStellarRevokeTokenTx:()=>Me,buildStellarSetAccumulatorTx:()=>De,buildStellarSetAggregatorTx:()=>qe,buildStellarSetLiquidityPoolTemplateTx:()=>We,buildStellarSetMarketOracleConfigTx:()=>Fe,buildStellarSetOracleSanityBoundsTx:()=>je,buildStellarSetOracleToleranceTx:()=>Xe,buildStellarSetPositionLimitsTx:()=>Ve,buildStellarSetSpokeAssetFlagsTx:()=>He,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>G,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>j,buildStellarTransferOwnershipTx:()=>Ge,buildStellarUnpauseTx:()=>$e,buildStellarUpdateAccountThresholdTx:()=>tt,buildStellarUpdateIndexesTx:()=>Qe,buildStellarUpgradeControllerTx:()=>Oe,buildStellarUpgradeLiquidityPoolParamsTx:()=>Ye,buildStellarWithdrawBatchTx:()=>D,buildStellarWithdrawTx:()=>W,buildTx:()=>N,decodeStellarLendingEvent:()=>Ar,encodeInterestRateModel:()=>xe,encodeMarketOracleConfigInput:()=>Pe,encodeMarketParamsRaw:()=>ke,encodeOracleSourceConfigInput:()=>Ee,encodePositionLimits:()=>Re,encodeStrategyPayloadToRouteXdr:()=>Dr,extractEventOrder:()=>Br,getStellarAccountPositions:()=>he,getStellarAggregatorQuote:()=>Gr,getStellarAggregatorRouter:()=>u,getStellarAsset:()=>ie,getStellarAssetGraph:()=>be,getStellarAssetMarkets:()=>ce,getStellarAssetPage:()=>ue,getStellarAssets:()=>re,getStellarGovernance:()=>c,getStellarGovernanceProposals:()=>Se,getStellarHub:()=>de,getStellarHubGraph:()=>_e,getStellarHubs:()=>oe,getStellarLendingContext:()=>ee,getStellarLendingController:()=>i,getStellarLendingLiveState:()=>te,getStellarQuoteTokens:()=>Cr,getStellarReserve:()=>se,getStellarReserveGraph:()=>we,getStellarReserveHolders:()=>le,getStellarReserves:()=>ne,getStellarSpoke:()=>pe,getStellarSpokeGraph:()=>ge,getStellarSpokes:()=>ae,getStellarUserActivity:()=>fe,getStellarUserPositions:()=>me,mapQuoteResponseToAggregatorSwap:()=>Fr,mapQuoteResponseToStrategyPayload:()=>zr,mapQuoteResponseToStrategySwap:()=>Mr,mapSorobanError:()=>to,mapStellarPositionActivityType:()=>$r,prepareStellarBuiltTx:()=>Qr,prepareStellarTxXdr:()=>jr,stellarLendingDispatchKey:()=>ur,stellarLendingRead:()=>Te,syntheticEventOrder:()=>Lr,tagStellarInvokedContractError:()=>Hr,toBase64Xdr:()=>lr,toStellarPositionMode:()=>Kr});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},o={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},a={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},n={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},s={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 i(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 u(e){const t=o[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 c(e){const t=a[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const d=require("@stellar/stellar-sdk"),p=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],m=e=>new d.Address(e).toScVal(),f=e=>new d.ScInt(e).toI128(),h=e=>d.xdr.ScVal.scvU32(e),S=e=>new d.ScInt("string"==typeof e?e:e.toString()).toU64(),b=e=>d.xdr.ScVal.scvBool(e),_=e=>d.xdr.ScVal.scvString(e),g=e=>d.xdr.ScVal.scvSymbol(e),w=()=>d.xdr.ScVal.scvVoid(),T=e=>d.xdr.ScVal.scvVec(e),y=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return d.xdr.ScVal.scvBytes(o)},v=(e,t)=>null==e?w():t(e),x=e=>d.xdr.ScVal.scvVec(e.map((e=>{return t=e.token,r=e.amount,d.xdr.ScVal.scvVec([m(t),f(r)]);var t,r}))),k=(e,t)=>A({asset:m(t),hub_id:h(e)}),R=(e,t,r)=>d.xdr.ScVal.scvVec([k(e,t),f(r)]),I=e=>d.xdr.ScVal.scvVec(e.map((e=>R(e.hubId,e.asset,e.amount)))),A=e=>{const t=Object.keys(e).sort().map((t=>new d.xdr.ScMapEntry({key:g(t),val:e[t]})));return d.xdr.ScVal.scvMap(t)},E=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return A({amount_out:f(e.amountOut),pool:m(e.pool),token_in:m(e.tokenIn),token_out:m(e.tokenOut),venue:(t=e.venue,d.xdr.ScVal.scvVec([g(t)]))});var t}));return A({hops:d.xdr.ScVal.scvVec(t),split_ppm:h(e.splitPpm)})}));return A({paths:d.xdr.ScVal.scvVec(t),referral_id:S(e.referralId??0),token_in:m(e.tokenIn),token_out:m(e.tokenOut),total_min_out:f(e.totalMinOut)})},P=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 d.xdr.ScVal.scvBytes(t)},O=()=>d.xdr.ScVal.scvBytes(Buffer.alloc(0)),B=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},L=e=>{if("string"==typeof e)return P(B(e));if(e instanceof Uint8Array)return 0===e.length?O():P(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?P(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(B(e.bytes)):0===e.bytes.length?O():P(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!p.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),d.xdr.ScVal.scvBytes(Buffer.from(E(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},$=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return d.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return d.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function N(e,t,r){const o=e.controllerAddress??i(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return N(e,"supply",[m(e.caller),S(r),h(o),I([...t.assets])])}function G(e,t){return U(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function C(e,t){return N(e,"borrow",[m(e.caller),S(t.accountNonce),I([...t.borrows]),v(t.to,m)])}function q(e,t){return C(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return N(e,"withdraw",[m(e.caller),S(t.accountNonce),I([...t.withdrawals]),v(t.to,m)])}function W(e,t){return D(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function V(e,t){return N(e,"repay",[m(e.caller),S(t.accountNonce),I([...t.payments])])}function z(e,t){return V(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function M(e,t){return N(e,"liquidate",[m(e.caller),S(t.accountNonce),I([...t.debtPayments])])}function F(e,t){return N(e,"flash_loan",[m(e.caller),k(t.hubId,t.asset),f(t.amount),m(t.receiver),$(t.data)])}function X(e,t){return N(e,"migrate_from_blend",[m(e.caller),S(t.accountId),h(t.spokeId),h(t.hubId),m(t.blendPool),T(t.collateralTokens.map(m)),T(t.supplyTokens.map(m)),x(t.debtCaps.map((e=>({token:e.token,amount:e.cap}))))])}function H(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return N(e,"multiply",[m(e.caller),S(r),h(o),k(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),k(t.debt.hubId,t.debt.asset),h(t.mode),L(t.steps),v(t.initialPayment,(e=>R(e.hubId,e.asset,e.amount))),v(t.convertSwap,L)])}function j(e,t){return N(e,"swap_debt",[m(e.caller),S(t.accountNonce),k(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),k(t.newDebt.hubId,t.newDebt.asset),L(t.steps)])}function Q(e,t){return N(e,"swap_collateral",[m(e.caller),S(t.accountNonce),k(t.current.hubId,t.current.asset),f(t.fromAmount),k(t.newCollateral.hubId,t.newCollateral.asset),L(t.steps)])}function K(e,t){return N(e,"repay_debt_with_collateral",[m(e.caller),S(t.accountNonce),k(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),k(t.debt.hubId,t.debt.asset),L(t.steps),b(t.closePosition)])}const Z="/stellar-lending",Y=25,J=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${Z}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/live-state`,t),re=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),oe=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),ae=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),ne=(e,t={},r)=>{const{hubId:o,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${Z}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},se=(e,t,r,o,a)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${J(o)}`,a),le=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${J(o)}/holders`,{...n,params:{side:a}}),ie=(e,t,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}`,r),ue=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/page`,{...o,params:{...r}}),ce=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/markets`,{...o,params:{side:r}}),de=(e,t,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,r),pe=(e,t,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${Z}/users/${J(t)}/positions`,r),fe=(e,t,r={},o)=>{const{skip:a,top:n}=r;return e.fetchWithTimeout(`${Z}/users/${J(t)}/activity`,{...o,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},he=(e,t,r)=>e.fetchWithTimeout(`${Z}/accounts/${J(t)}/positions`,r),Se=(e,t={},r)=>{const{top:o=Y,continuationToken:a}=t;return e.fetchWithTimeout(`${Z}/governance/proposals`,{...r,params:{top:o,...a?{continuationToken:a}:{}}})},be=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/graph`,{...o,params:{...r}}),_e=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...o,params:{...r}}),ge=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...o,params:{...r}}),we=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${J(o)}/graph`,{...n,params:{...a}}),Te=e=>({context:t=>ee(e,t),liveState:t=>te(e,t),assets:t=>re(e,t),hubs:t=>oe(e,t),spokes:t=>ae(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?ne(e,t,r):ne(e,{},t);var o},reserve:(t,r,o,a)=>se(e,t,r,o,a),reserveHolders:(t,r,o,a,n)=>le(e,t,r,o,a,n),asset:(t,r)=>ie(e,t,r),assetMarkets:(t,r,o)=>ce(e,t,r,o),hub:(t,r)=>de(e,t,r),spoke:(t,r)=>pe(e,t,r),userPositions:(t,r)=>me(e,t,r),userActivity:(t,r,o)=>fe(e,t,r,o),accountPositions:(t,r)=>he(e,t,r),governanceProposals:(t,r)=>Se(e,t,r),assetGraph:(t,r,o)=>be(e,t,r,o),hubGraph:(t,r,o)=>_e(e,t,r,o),spokeGraph:(t,r,o)=>ge(e,t,r,o),reserveGraph:(t,r,o,a,n)=>we(e,t,r,o,a,n)}),ye={Single:0,PrimaryWithAnchor:1},ve="RedStonePriceFeed",xe=e=>A({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),ke=e=>A({asset_decimals:h(e.assetDecimals),asset_id:m(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:b(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),Re=e=>A({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),Ie=e=>{const t=e.kind;switch(t){case"Stellar":return T([g("Stellar"),m(e.value)]);case"Symbol":return T([g("Symbol"),g(e.value)]);case"String":return T([g("String"),_(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Ae=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return T([g("Twap"),h(t)])}return T([g("Spot")])},Ee=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return T([g("Reflector"),A({asset:Ie(e.asset),contract:m(e.contract),read_mode:Ae(e.readMode,e.twapRecords)})])}if(t===ve||"XoxnoPriceFeed"===t){const r=t===ve?"RedStone":"Xoxno";if("string"!=typeof e.feedId)throw new Error(`Stellar builder: ${r} oracle source requires \`feedId\``);if("number"!=typeof e.maxStaleSeconds)throw new Error(`Stellar builder: ${r} oracle source requires \`maxStaleSeconds\``);return T([g(r),A({contract:m(e.contract),feed_id:_(e.feedId),max_stale_seconds:S(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Pe=e=>{const t=ye[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return A({anchor:(r=e.anchor,T(null==r?[g("None")]:[g("Some"),Ee(r)])),max_price_stale_seconds:S(e.maxPriceStaleSeconds),max_sanity_price_wad:f(e.maxSanityPriceWad),min_sanity_price_wad:f(e.minSanityPriceWad),primary:Ee(e.primary),strategy:h(t),tolerance_bps:h(e.toleranceBps)});var r};function Oe(e,t){return N(e,"upgrade",[y(t.wasmHash)])}function Be(e,t){return N(e,"migrate",[h(t.newVersion)])}function Le(e){return N(e,"pause",[])}function $e(e){return N(e,"unpause",[])}function Ne(e,t){return N(e,"grant_role",[m(t.account),g(t.role)])}function Ue(e,t){return N(e,"revoke_role",[m(t.account),g(t.role)])}function Ge(e,t){return N(e,"transfer_ownership",[m(t.newOwner),h(t.liveUntilLedger)])}function Ce(e){return N(e,"accept_ownership",[])}function qe(e,t){return N(e,"set_aggregator",[m(t.aggregator)])}function De(e,t){return N(e,"set_accumulator",[m(t.accumulator)])}function We(e,t){return N(e,"set_liquidity_pool_template",[y(t.wasmHash)])}function Ve(e,t){return N(e,"set_position_limits",[Re(t)])}function ze(e,t){return N(e,"approve_token",[m(t.token)])}function Me(e,t){return N(e,"revoke_token",[m(t.token)])}function Fe(e,t){return N(e,"set_market_oracle_config",[k(t.hubId,t.asset),Pe(t.config)])}function Xe(e,t){return N(e,"set_oracle_tolerance",[m(t.asset),A({lower_ratio_bps:h(t.lowerRatioBps),upper_ratio_bps:h(t.upperRatioBps)})])}function He(e,t){return N(e,"set_spoke_asset_flags",[h(t.spokeId),k(t.hubId,t.asset),b(t.paused),b(t.frozen)])}function je(e,t){return N(e,"set_oracle_sanity_bounds",[m(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Qe(e,t){return N(e,"update_indexes",[m(e.caller),T(t.assets.map((e=>k(e.hubId,e.asset))))])}function Ke(e,t){return N(e,"renew_account",[m(e.caller),S(t.accountNonce)])}function Ze(e,t){return N(e,"create_liquidity_pool",[h(t.hubId),m(t.asset),ke(t.params)])}function Ye(e,t){return N(e,"upgrade_liquidity_pool_params",[k(t.hubId,t.asset),xe(t.params)])}function Je(e,t){return N(e,"claim_revenue",[m(e.caller),T(t.assets.map((e=>k(e.hubId,e.asset))))])}function et(e,t){return N(e,"add_rewards",[m(e.caller),I(t.rewards)])}function tt(e,t){return N(e,"update_account_threshold",[m(e.caller),b(t.hasRisks),T(t.accountNonces.map((e=>S(e))))])}const rt="00".repeat(32),ot=e=>{if("string"==typeof e)return y(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 d.xdr.ScVal.scvBytes(t)},at=(e,...t)=>T([g(e),...t]),nt=e=>A({asset:m(e.asset),hub_id:h(e.hubId),params:ke(e.params)}),st=e=>A({hub_asset:k(e.hubId,e.asset),params:xe(e.params)}),lt=e=>A({new_owner:m(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),it=e=>A({cfg:Pe(e.config),hub_asset:k(e.hubId,e.asset)}),ut=e=>A({asset:m(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:b(e.canBorrow),can_collateral:b(e.canCollateral),frozen:b(e.frozen),hub_id:h(e.hubId),paused:b(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),oracle_override:T([g("None")]),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),ct=e=>A({hub_asset:k(e.hubId,e.asset),spoke_id:h(e.spokeId)}),dt=e=>A({hf_for_max_bonus_wad:f(e.hfForMaxBonusWad),liquidation_bonus_factor_bps:h(e.liquidationBonusFactorBps),spoke_id:h(e.spokeId),target_hf_wad:f(e.targetHfWad)}),pt=e=>A({asset:m(e.asset),tolerance:h(e.tolerance)}),mt=e=>A({account:m(e.account),role:g(e.role)});function ft(e,t,r){const o=e.governanceAddress??c(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ht=(e,t,r)=>ft(e,"propose",[m(e.caller),t,ot(r)]),St=(e,t,r)=>ft(e,"execute_self",[w(),t,ot(r)]);function bt(e,t,r){return ht(e,at("SetAggregator",m(t.aggregator)),r)}function _t(e,t,r){return ht(e,at("SetAccumulator",m(t.accumulator)),r)}function gt(e,t,r){return ht(e,at("SetLiquidityPoolTemplate",y(t.wasmHash)),r)}function wt(e,t,r){return ht(e,at("SetPositionLimits",Re(t)),r)}function Tt(e,t){return ht(e,at("CreateHub"),t)}function yt(e,t){return ht(e,at("AddSpoke"),t)}function vt(e,t,r){return ht(e,at("RemoveSpoke",h(t.spokeId)),r)}function xt(e,t,r){return ht(e,at("AddAssetToSpoke",ut(t)),r)}function kt(e,t,r){return ht(e,at("EditAssetInSpoke",ut(t)),r)}function Rt(e,t,r){return ht(e,at("RemoveAssetFromSpoke",ct(t)),r)}function It(e,t,r){return ht(e,at("SetSpokeLiquidationCurve",dt(t)),r)}function At(e,t,r){return ht(e,at("SetPositionManager",m(t.manager),b(t.isActive)),r)}function Et(e,t,r){return ht(e,at("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function Pt(e,t,r){return ht(e,at("ApproveToken",m(t.token)),r)}function Ot(e,t,r){return ht(e,at("RevokeToken",m(t.token)),r)}function Bt(e,t,r){return ht(e,at("ApproveBlendPool",m(t.pool)),r)}function Lt(e,t,r){return ht(e,at("RevokeBlendPool",m(t.pool)),r)}function $t(e,t,r){return ht(e,at("CreateLiquidityPool",nt(t)),r)}function Nt(e,t,r){return ht(e,at("UpgradeLiquidityPoolParams",st(t)),r)}function Ut(e,t){return ht(e,at("DeployPool"),t)}function Gt(e,t,r){return ht(e,at("UpgradePool",y(t.wasmHash)),r)}function Ct(e,t,r){return ht(e,at("UpgradeController",y(t.wasmHash)),r)}function qt(e,t,r){return ht(e,at("MigrateController",h(t.newVersion)),r)}function Dt(e,t,r){return ht(e,at("TransferCtrlOwnership",lt(t)),r)}function Wt(e,t,r){return ht(e,at("ConfigureMarketOracle",it(t)),r)}function Vt(e,t,r){return ht(e,at("EditOracleTolerance",pt(t)),r)}function zt(e,t,r){return ht(e,at("UpgradeGov",y(t.wasmHash)),r)}function Mt(e,t,r){return ht(e,at("UpdateGovDelay",h(t.newDelay)),r)}function Ft(e,t,r){return ht(e,at("GrantGovRole",mt(t)),r)}function Xt(e,t,r){return ht(e,at("RevokeGovRole",mt(t)),r)}function Ht(e,t,r){return ht(e,at("TransferGovOwnership",lt(t)),r)}function jt(e,t){const r=T(t.argsXdr.map((e=>d.xdr.ScVal.fromXDR(e,"base64")))),o=ot(t.predecessor??rt);return ft(e,"execute",[w(),m(t.target),g(t.functionName),r,o,ot(t.salt)])}function Qt(e,t,r){return St(e,at("UpgradeGov",y(t.wasmHash)),r)}function Kt(e,t,r){return St(e,at("UpdateGovDelay",h(t.newDelay)),r)}function Zt(e,t,r){return St(e,at("GrantGovRole",mt(t)),r)}function Yt(e,t,r){return St(e,at("RevokeGovRole",mt(t)),r)}function Jt(e,t,r){return St(e,at("TransferGovOwnership",lt(t)),r)}function er(e,t){return ft(e,"set_spoke_asset_flags",[m(e.caller),h(t.spokeId),k(t.hubId,t.asset),b(t.paused),b(t.frozen)])}function tr(e,t){return ft(e,"set_oracle_sanity_bounds",[m(e.caller),m(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function rr(e){return ft(e,"create_hub",[m(e.caller)])}function or(e){return ft(e,"add_spoke",[m(e.caller)])}function ar(e,t){return ft(e,"revoke_role_immediate",[m(t.account),g(t.role)])}function nr(e){return ft(e,"pause",[m(e.caller)])}function sr(e,t){return ht(e,at("Unpause"),t)}const lr=e=>e.toXDR("base64"),ir=e=>d.xdr.ScVal.fromXDR(e,"base64"),ur=e=>e.map((e=>String((0,d.scValToNative)(ir(e))))).join(":"),cr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),dr=e=>Number(e),pr=e=>String(e),mr=e=>null==e?void 0:cr(e),fr=e=>null==e?void 0:pr(e),hr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Sr=["None","Multiply","Long","Short"],br=["Single","PrimaryWithAnchor"],_r=["ReflectorSep40","RedStonePriceFeed"],gr=["Spot","Twap"],wr=["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"],Tr=e=>Array.isArray(e)?e:[],yr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],wr[dr(o)]??cr(o)),positionType:t,hubId:dr(e[1]),asset:pr(e[2]),scaledAmountRay:cr(e[3]),indexRay:cr(e[4]),amount:cr(e[5]),liquidationThresholdBps:r?void 0:dr(e[6]),liquidationBonusBps:r?void 0:dr(e[7]),loanToValueBps:r?void 0:dr(e[8]),liquidationFeesBps:r?void 0:dr(e[9])};var o},vr=e=>{return{owner:pr(e[0]),spokeId:dr(e[1]),mode:(t=e[2],Sr[dr(t)]??"None")};var t},xr=(e,t)=>{const r=gr[dr(e[`${t}_read_mode`])]??"Spot",o=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=o?{kind:"Stellar",value:pr(o)}:null!=a?{kind:"Symbol",value:pr(a)}:void 0;return{provider:_r[dr(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:pr(e[`${t}_contract`]),asset:n,feedId:fr(e[`${t}_feed_id`]),readMode:r,twapRecords:"Twap"===r?dr(e[`${t}_twap_records`]):void 0,decimals:dr(e[`${t}_decimals`]),resolutionSeconds:dr(e[`${t}_resolution_seconds`]),maxStaleSeconds:dr(e[`${t}_max_stale_seconds`])}},kr=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:pr(e.base_token_id),quoteTokenId:pr(e.quote_token_id),tolerance:{upperRatio:dr(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:dr(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:dr(e.asset_decimals),maxPriceStaleSeconds:dr(e.max_price_stale_seconds),strategy:br[dr(e.strategy)]??"Single",primary:xr(e,"primary"),anchor:t?xr(e,"anchor"):void 0,primaryQuoteToken:fr(e.primary_quote_token),anchorQuoteToken:fr(e.anchor_quote_token),minSanityPriceWad:mr(e.min_sanity_price_wad),maxSanityPriceWad:mr(e.max_sanity_price_wad)}},Rr={"market:create":e=>({topic:"market:create",data:{hubId:dr(e.hub_id),baseAsset:pr(e.base_asset),maxBorrowRate:cr(e.max_borrow_rate),baseBorrowRate:cr(e.base_borrow_rate),slope1:cr(e.slope1),slope2:cr(e.slope2),slope3:cr(e.slope3),midUtilization:cr(e.mid_utilization),optimalUtilization:cr(e.optimal_utilization),maxUtilization:cr(e.max_utilization),reserveFactor:dr(e.reserve_factor),marketAddress:pr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:pr(e.asset),maxBorrowRateRay:cr(e.max_borrow_rate),baseBorrowRateRay:cr(e.base_borrow_rate),slope1Ray:cr(e.slope1),slope2Ray:cr(e.slope2),slope3Ray:cr(e.slope3),midUtilizationRay:cr(e.mid_utilization),optimalUtilizationRay:cr(e.optimal_utilization),maxUtilizationRay:cr(e.max_utilization),reserveFactorBps:dr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Tr(e).map((e=>{return t=Tr(e),{hubId:dr(t[0]),asset:pr(t[1]),timestamp:dr(t[2]),supplyIndexRay:cr(t[3]),borrowIndexRay:cr(t[4]),cash:cr(t[5]),suppliedRay:cr(t[6]),borrowedRay:cr(t[7]),revenueRay:cr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Tr(e).map((e=>{const t=e;return{hubId:dr(t.hub_id),asset:pr(t.asset),params:(r=t.params,{maxBorrowRateRay:cr(r.max_borrow_rate),baseBorrowRateRay:cr(r.base_borrow_rate),slope1Ray:cr(r.slope1),slope2Ray:cr(r.slope2),slope3Ray:cr(r.slope3),midUtilizationRay:cr(r.mid_utilization),optimalUtilizationRay:cr(r.optimal_utilization),maxUtilizationRay:cr(r.max_utilization),reserveFactorBps:dr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:dr(r.flashloan_fee),assetId:pr(r.asset_id),assetDecimals:dr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Tr(e);return{topic:"position:batch_update",data:{accountId:cr(t[0]),accountAttributes:vr(Tr(t[1])),updates:[...Tr(t[2]).map((e=>yr(Tr(e),"Deposit"))),...Tr(t[3]).map((e=>yr(Tr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:dr(e.hub_id),asset:pr(e.asset),receiver:pr(e.receiver),caller:pr(e.caller),amount:cr(e.amount),fee:cr(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:pr(e.asset),oracle:kr(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:pr(e.liquidator),accountId:cr(e.account_id),repaidUsdWad:cr(e.repaid_usd_wad),bonusBps:cr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:cr(e.account_id),totalBorrowUsdWad:cr(e.total_borrow_usd_wad),totalCollateralUsdWad:cr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:pr(e.token),amount:cr(e.amount),usdValueWad:cr(e.usd_value_wad),accountId:cr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:dr(e.hub_id),asset:pr(e.asset),amount:cr(e.amount),fee:cr(e.fee),amountSent:cr(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:hr(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:pr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:pr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:hr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:dr(e.max_supply_positions),maxBorrowPositions:dr(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:pr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:dr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:cr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:cr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:dr(t.liquidation_bonus_factor_bps)}}}},Ir=Object.freeze(Object.keys(Rr));function Ar(e,t){const r=ur(e),o=Rr[r];return o?o((0,d.scValToNative)(ir(t))):null}const Er="XLENDXLM-a7c9f3",Pr=1e4;function Or(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${Er}-${r}`}function Br(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Lr(e,t=0){return e*Pr+t}function $r(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Nr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Ur=e=>e.baseUrl??s[e.network];async function Gr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=Nr(Ur(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function Cr(e){const t=Nr(Ur(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const qr=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,Dr=e=>E(e).toXDR("base64");function Wr(e,t){const r=e.routerAddress??u(e.network),o=new d.Contract(r),a=new d.Account(e.caller,e.sourceSequence),n=L(qr(t,e.referralId));return{xdr:new d.TransactionBuilder(a,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",m(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Vr(e,t){return Wr(e,t)}function zr(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(Xr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Xr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Mr(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:zr(e,t)}const Fr=zr,Xr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Hr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function jr(e,t,r){const o=d.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Hr(r.invokedContractId,e);throw e}}async function Qr(e,t,r){return jr(e,t.xdr,r)}function Kr(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 Zr(e,t){return new Uint8Array(0)}const Yr=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 Jr(e){const t=new d.Account(e.caller,e.sourceSequence),r=new d.Contract(e.forwarderAddress).call("mint_and_forward",d.xdr.ScVal.scvBytes(Yr(e.message)),d.xdr.ScVal.scvBytes(Yr(e.attestation)));return{xdr:new d.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const eo={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function to(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=eo[r];return o?{code:r,...o}:null}module.exports=t})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as e,Address as t,BASE_FEE as o,Contract as r,ScInt as a,TransactionBuilder as n,scValToNative as s,xdr as i}from"@stellar/stellar-sdk";const u={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},l={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},c={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},p={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},d={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},m={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function f(e){const t=u[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 h(e){const t=l[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 _(e){const t=c[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const b=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],w=e=>new t(e).toScVal(),g=e=>new a(e).toI128(),y=e=>i.ScVal.scvU32(e),v=e=>new a("string"==typeof e?e:e.toString()).toU64(),S=e=>i.ScVal.scvBool(e),k=e=>i.ScVal.scvString(e),I=e=>i.ScVal.scvSymbol(e),R=()=>i.ScVal.scvVoid(),T=e=>i.ScVal.scvVec(e),x=(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 i.ScVal.scvBytes(r)},A=(e,t)=>null==e?R():t(e),E=(e,t)=>N({asset:w(t),hub_id:y(e)}),$=(e,t,o)=>i.ScVal.scvVec([E(e,t),g(o)]),B=e=>i.ScVal.scvVec(e.map((e=>$(e.hubId,e.asset,e.amount)))),N=e=>{const t=Object.keys(e).sort().map((t=>new i.ScMapEntry({key:I(t),val:e[t]})));return i.ScVal.scvMap(t)},O=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return N({amount_out:g(e.amountOut),pool:w(e.pool),token_in:w(e.tokenIn),token_out:w(e.tokenOut),venue:(t=e.venue,i.ScVal.scvVec([I(t)]))});var t}));return N({hops:i.ScVal.scvVec(t),split_ppm:y(e.splitPpm)})}));return N({paths:i.ScVal.scvVec(t),referral_id:v(e.referralId??0),token_in:w(e.tokenIn),token_out:w(e.tokenOut),total_min_out:g(e.totalMinOut)})},P=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 i.ScVal.scvBytes(t)},U=()=>i.ScVal.scvBytes(Buffer.alloc(0)),q=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},L=e=>{if("string"==typeof e)return P(q(e));if(e instanceof Uint8Array)return 0===e.length?U():P(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?P(q(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(q(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(q(e.bytes)):0===e.bytes.length?U():P(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||!b.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),i.ScVal.scvBytes(Buffer.from(O(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},z=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return i.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return i.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function V(t,a,s){const i=t.controllerAddress??f(t.network),u=new r(i),l=new e(t.caller,t.sourceSequence);return{xdr:new n(l,{fee:t.fee??o,networkPassphrase:m[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function W(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return V(e,"supply",[w(e.caller),v(o),y(r),B([...t.assets])])}function D(e,t){return W(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function C(e,t){return V(e,"borrow",[w(e.caller),v(t.accountNonce),B([...t.borrows]),A(t.to,w)])}function G(e,t){return C(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function X(e,t){return V(e,"withdraw",[w(e.caller),v(t.accountNonce),B([...t.withdrawals]),A(t.to,w)])}function F(e,t){return X(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function M(e,t){return V(e,"repay",[w(e.caller),v(t.accountNonce),B([...t.payments])])}function H(e,t){return M(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function j(e,t){return V(e,"liquidate",[w(e.caller),v(t.accountNonce),B([...t.debtPayments])])}function Q(e,t){return V(e,"flash_loan",[w(e.caller),E(t.hubId,t.asset),g(t.amount),w(t.receiver),z(t.data)])}function Z(e,t){return V(e,"migrate_from_blend",[w(e.caller),v(t.accountId),y(t.spokeId),y(t.hubId),w(t.blendPool),T(t.collateralTokens.map(w)),T(t.supplyTokens.map(w)),(o=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),i.ScVal.scvVec(o.map((e=>{return t=e.token,o=e.amount,i.ScVal.scvVec([w(t),g(o)]);var t,o}))))]);var o}function J(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return V(e,"multiply",[w(e.caller),v(o),y(r),E(t.collateral.hubId,t.collateral.asset),g(t.debtToFlashLoan),E(t.debt.hubId,t.debt.asset),y(t.mode),L(t.steps),A(t.initialPayment,(e=>$(e.hubId,e.asset,e.amount))),A(t.convertSwap,L)])}function K(e,t){return V(e,"swap_debt",[w(e.caller),v(t.accountNonce),E(t.existingDebt.hubId,t.existingDebt.asset),g(t.newDebtAmount),E(t.newDebt.hubId,t.newDebt.asset),L(t.steps)])}function Y(e,t){return V(e,"swap_collateral",[w(e.caller),v(t.accountNonce),E(t.current.hubId,t.current.asset),g(t.fromAmount),E(t.newCollateral.hubId,t.newCollateral.asset),L(t.steps)])}function ee(e,t){return V(e,"repay_debt_with_collateral",[w(e.caller),v(t.accountNonce),E(t.collateral.hubId,t.collateral.asset),g(t.collateralAmount),E(t.debt.hubId,t.debt.asset),L(t.steps),S(t.closePosition)])}const te="/stellar-lending",oe=25,re=encodeURIComponent,ae=(e,t)=>e.fetchWithTimeout(`${te}/context`,t),ne=(e,t)=>e.fetchWithTimeout(`${te}/assets`,t),se=(e,t)=>e.fetchWithTimeout(`${te}/hubs`,t),ie=(e,t)=>e.fetchWithTimeout(`${te}/spokes`,t),ue=(e,t={},o)=>{const{hubId:r,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${te}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},le=(e,t,o,r,a)=>e.fetchWithTimeout(`${te}/reserves/${t}/${o}/${re(r)}`,a),ce=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${te}/reserves/${t}/${o}/${re(r)}/holders`,{...n,params:{side:a}}),pe=(e,t,o)=>e.fetchWithTimeout(`${te}/assets/${re(t)}`,o),de=(e,t,o,r)=>e.fetchWithTimeout(`${te}/assets/${re(t)}/page`,{...r,params:{...o}}),me=(e,t,o,r)=>e.fetchWithTimeout(`${te}/assets/${re(t)}/markets`,{...r,params:{side:o}}),fe=(e,t,o)=>e.fetchWithTimeout(`${te}/hubs/${t}`,o),he=(e,t,o)=>e.fetchWithTimeout(`${te}/spokes/${t}`,o),_e=(e,t,o)=>e.fetchWithTimeout(`${te}/users/${re(t)}/positions`,o),be=(e,t,o={},r)=>{const{skip:a,top:n}=o;return e.fetchWithTimeout(`${te}/users/${re(t)}/activity`,{...r,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},we=(e,t,o)=>e.fetchWithTimeout(`${te}/accounts/${re(t)}/positions`,o),ge=(e,t={},o)=>{const{top:r=oe,continuationToken:a}=t;return e.fetchWithTimeout(`${te}/governance/proposals`,{...o,params:{top:r,...a?{continuationToken:a}:{}}})},ye=(e,t,o,r)=>e.fetchWithTimeout(`${te}/assets/${re(t)}/graph`,{...r,params:{...o}}),ve=(e,t,o,r)=>e.fetchWithTimeout(`${te}/hubs/${t}/graph`,{...r,params:{...o}}),Se=(e,t,o,r)=>e.fetchWithTimeout(`${te}/spokes/${t}/graph`,{...r,params:{...o}}),ke=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${te}/reserves/${t}/${o}/${re(r)}/graph`,{...n,params:{...a}}),Ie=e=>({context:t=>ae(e,t),assets:t=>ne(e,t),hubs:t=>se(e,t),spokes:t=>ie(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?ue(e,t,o):ue(e,{},t);var r},reserve:(t,o,r,a)=>le(e,t,o,r,a),reserveHolders:(t,o,r,a,n)=>ce(e,t,o,r,a,n),asset:(t,o)=>pe(e,t,o),assetMarkets:(t,o,r)=>me(e,t,o,r),hub:(t,o)=>fe(e,t,o),spoke:(t,o)=>he(e,t,o),userPositions:(t,o)=>_e(e,t,o),userActivity:(t,o,r)=>be(e,t,o,r),accountPositions:(t,o)=>we(e,t,o),governanceProposals:(t,o)=>ge(e,t,o),assetGraph:(t,o,r)=>ye(e,t,o,r),hubGraph:(t,o,r)=>ve(e,t,o,r),spokeGraph:(t,o,r)=>Se(e,t,o,r),reserveGraph:(t,o,r,a,n)=>ke(e,t,o,r,a,n)}),Re={Single:0,PrimaryWithAnchor:1},Te="RedStonePriceFeed",xe=e=>N({base_borrow_rate:g(e.baseBorrowRateRay),max_borrow_rate:g(e.maxBorrowRateRay),max_utilization:g(e.maxUtilizationRay),mid_utilization:g(e.midUtilizationRay),optimal_utilization:g(e.optimalUtilizationRay),reserve_factor:y(e.reserveFactorBps),slope1:g(e.slope1Ray),slope2:g(e.slope2Ray),slope3:g(e.slope3Ray)}),Ae=e=>N({asset_decimals:y(e.assetDecimals),asset_id:w(e.assetId),base_borrow_rate:g(e.baseBorrowRateRay),flashloan_fee:y(e.flashloanFeeBps),is_flashloanable:S(e.isFlashloanable),max_borrow_rate:g(e.maxBorrowRateRay),max_utilization:g(e.maxUtilizationRay),mid_utilization:g(e.midUtilizationRay),optimal_utilization:g(e.optimalUtilizationRay),reserve_factor:y(e.reserveFactorBps),slope1:g(e.slope1Ray),slope2:g(e.slope2Ray),slope3:g(e.slope3Ray)}),Ee=e=>N({max_borrow_positions:y(e.maxBorrowPositions),max_supply_positions:y(e.maxSupplyPositions)}),$e=e=>{const t=e.kind;switch(t){case"Stellar":return T([I("Stellar"),w(e.value)]);case"Symbol":return T([I("Symbol"),I(e.value)]);case"String":return T([I("String"),k(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Be=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return T([I("Twap"),y(t)])}return T([I("Spot")])},Ne=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return T([I("Reflector"),N({asset:$e(e.asset),contract:w(e.contract),read_mode:Be(e.readMode,e.twapRecords)})])}if(t===Te||"XoxnoPriceFeed"===t){const o=t===Te?"RedStone":"Xoxno";if("string"!=typeof e.feedId)throw new Error(`Stellar builder: ${o} oracle source requires \`feedId\``);if("number"!=typeof e.maxStaleSeconds)throw new Error(`Stellar builder: ${o} oracle source requires \`maxStaleSeconds\``);return T([I(o),N({contract:w(e.contract),feed_id:k(e.feedId),max_stale_seconds:v(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Oe=e=>{const t=Re[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return N({anchor:(o=e.anchor,T(null==o?[I("None")]:[I("Some"),Ne(o)])),max_price_stale_seconds:v(e.maxPriceStaleSeconds),max_sanity_price_wad:g(e.maxSanityPriceWad),min_sanity_price_wad:g(e.minSanityPriceWad),primary:Ne(e.primary),strategy:y(t),tolerance_bps:y(e.toleranceBps)});var o};function Pe(e,t){return V(e,"upgrade",[x(t.wasmHash)])}function Ue(e,t){return V(e,"migrate",[y(t.newVersion)])}function qe(e){return V(e,"pause",[])}function Le(e){return V(e,"unpause",[])}function ze(e,t){return V(e,"grant_role",[w(t.account),I(t.role)])}function Ve(e,t){return V(e,"revoke_role",[w(t.account),I(t.role)])}function We(e,t){return V(e,"transfer_ownership",[w(t.newOwner),y(t.liveUntilLedger)])}function De(e){return V(e,"accept_ownership",[])}function Ce(e,t){return V(e,"set_aggregator",[w(t.aggregator)])}function Ge(e,t){return V(e,"set_accumulator",[w(t.accumulator)])}function Xe(e,t){return V(e,"set_liquidity_pool_template",[x(t.wasmHash)])}function Fe(e,t){return V(e,"set_position_limits",[Ee(t)])}function Me(e,t){return V(e,"approve_token",[w(t.token)])}function He(e,t){return V(e,"revoke_token",[w(t.token)])}function je(e,t){return V(e,"set_market_oracle_config",[E(t.hubId,t.asset),Oe(t.config)])}function Qe(e,t){return V(e,"set_oracle_tolerance",[w(t.asset),N({lower_ratio_bps:y(t.lowerRatioBps),upper_ratio_bps:y(t.upperRatioBps)})])}function Ze(e,t){return V(e,"set_spoke_asset_flags",[y(t.spokeId),E(t.hubId,t.asset),S(t.paused),S(t.frozen)])}function Je(e,t){return V(e,"set_oracle_sanity_bounds",[w(t.asset),g(t.minPriceWad),g(t.maxPriceWad)])}function Ke(e,t){return V(e,"update_indexes",[w(e.caller),T(t.assets.map((e=>E(e.hubId,e.asset))))])}function Ye(e,t){return V(e,"renew_account",[w(e.caller),v(t.accountNonce)])}function et(e,t){return V(e,"create_liquidity_pool",[y(t.hubId),w(t.asset),Ae(t.params)])}function tt(e,t){return V(e,"upgrade_liquidity_pool_params",[E(t.hubId,t.asset),xe(t.params)])}function ot(e,t){return V(e,"claim_revenue",[w(e.caller),T(t.assets.map((e=>E(e.hubId,e.asset))))])}function rt(e,t){return V(e,"add_rewards",[w(e.caller),B(t.rewards)])}function at(e,t){return V(e,"update_account_threshold",[w(e.caller),S(t.hasRisks),T(t.accountNonces.map((e=>v(e))))])}const nt="00".repeat(32),st=e=>{if("string"==typeof e)return x(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 i.ScVal.scvBytes(t)},it=(e,...t)=>T([I(e),...t]),ut=e=>N({new_owner:w(e.newOwner),live_until_ledger:y(e.liveUntilLedger)}),lt=e=>N({asset:w(e.asset),bonus:y(e.bonus),borrow_cap:g(e.borrowCap),can_borrow:S(e.canBorrow),can_collateral:S(e.canCollateral),frozen:S(e.frozen),hub_id:y(e.hubId),paused:S(e.paused),liquidation_fees:y(e.liquidationFees),ltv:y(e.ltv),oracle_override:T([I("None")]),spoke_id:y(e.spokeId),supply_cap:g(e.supplyCap),threshold:y(e.threshold)}),ct=e=>N({account:w(e.account),role:I(e.role)});function pt(t,a,s){const i=t.governanceAddress??_(t.network),u=new r(i),l=new e(t.caller,t.sourceSequence);return{xdr:new n(l,{fee:t.fee??o,networkPassphrase:m[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const dt=(e,t,o)=>pt(e,"propose",[w(e.caller),t,st(o)]),mt=(e,t,o)=>pt(e,"execute_self",[R(),t,st(o)]);function ft(e,t,o){return dt(e,it("SetAggregator",w(t.aggregator)),o)}function ht(e,t,o){return dt(e,it("SetAccumulator",w(t.accumulator)),o)}function _t(e,t,o){return dt(e,it("SetLiquidityPoolTemplate",x(t.wasmHash)),o)}function bt(e,t,o){return dt(e,it("SetPositionLimits",Ee(t)),o)}function wt(e,t){return dt(e,it("CreateHub"),t)}function gt(e,t){return dt(e,it("AddSpoke"),t)}function yt(e,t,o){return dt(e,it("RemoveSpoke",y(t.spokeId)),o)}function vt(e,t,o){return dt(e,it("AddAssetToSpoke",lt(t)),o)}function St(e,t,o){return dt(e,it("EditAssetInSpoke",lt(t)),o)}function kt(e,t,o){return dt(e,it("RemoveAssetFromSpoke",N({hub_asset:E((r=t).hubId,r.asset),spoke_id:y(r.spokeId)})),o);var r}function It(e,t,o){return dt(e,it("SetSpokeLiquidationCurve",N({hf_for_max_bonus_wad:g((r=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:y(r.liquidationBonusFactorBps),spoke_id:y(r.spokeId),target_hf_wad:g(r.targetHfWad)})),o);var r}function Rt(e,t,o){return dt(e,it("SetPositionManager",w(t.manager),S(t.isActive)),o)}function Tt(e,t,o){return dt(e,it("SetMinBorrowCollateralUsd",g(t.floorWad)),o)}function xt(e,t,o){return dt(e,it("ApproveToken",w(t.token)),o)}function At(e,t,o){return dt(e,it("RevokeToken",w(t.token)),o)}function Et(e,t,o){return dt(e,it("ApproveBlendPool",w(t.pool)),o)}function $t(e,t,o){return dt(e,it("RevokeBlendPool",w(t.pool)),o)}function Bt(e,t,o){return dt(e,it("CreateLiquidityPool",N({asset:w((r=t).asset),hub_id:y(r.hubId),params:Ae(r.params)})),o);var r}function Nt(e,t,o){return dt(e,it("UpgradeLiquidityPoolParams",N({hub_asset:E((r=t).hubId,r.asset),params:xe(r.params)})),o);var r}function Ot(e,t){return dt(e,it("DeployPool"),t)}function Pt(e,t,o){return dt(e,it("UpgradePool",x(t.wasmHash)),o)}function Ut(e,t,o){return dt(e,it("UpgradeController",x(t.wasmHash)),o)}function qt(e,t,o){return dt(e,it("MigrateController",y(t.newVersion)),o)}function Lt(e,t,o){return dt(e,it("TransferCtrlOwnership",ut(t)),o)}function zt(e,t,o){return dt(e,it("ConfigureMarketOracle",N({cfg:Oe((r=t).config),hub_asset:E(r.hubId,r.asset)})),o);var r}function Vt(e,t,o){return dt(e,it("EditOracleTolerance",N({asset:w((r=t).asset),tolerance:y(r.tolerance)})),o);var r}function Wt(e,t,o){return dt(e,it("UpgradeGov",x(t.wasmHash)),o)}function Dt(e,t,o){return dt(e,it("UpdateGovDelay",y(t.newDelay)),o)}function Ct(e,t,o){return dt(e,it("GrantGovRole",ct(t)),o)}function Gt(e,t,o){return dt(e,it("RevokeGovRole",ct(t)),o)}function Xt(e,t,o){return dt(e,it("TransferGovOwnership",ut(t)),o)}function Ft(e,t){const o=T(t.argsXdr.map((e=>i.ScVal.fromXDR(e,"base64")))),r=st(t.predecessor??nt);return pt(e,"execute",[R(),w(t.target),I(t.functionName),o,r,st(t.salt)])}function Mt(e,t,o){return mt(e,it("UpgradeGov",x(t.wasmHash)),o)}function Ht(e,t,o){return mt(e,it("UpdateGovDelay",y(t.newDelay)),o)}function jt(e,t,o){return mt(e,it("GrantGovRole",ct(t)),o)}function Qt(e,t,o){return mt(e,it("RevokeGovRole",ct(t)),o)}function Zt(e,t,o){return mt(e,it("TransferGovOwnership",ut(t)),o)}function Jt(e,t){return pt(e,"set_spoke_asset_flags",[w(e.caller),y(t.spokeId),E(t.hubId,t.asset),S(t.paused),S(t.frozen)])}function Kt(e,t){return pt(e,"set_oracle_sanity_bounds",[w(e.caller),w(t.asset),g(t.minPriceWad),g(t.maxPriceWad)])}function Yt(e){return pt(e,"create_hub",[w(e.caller)])}function eo(e){return pt(e,"add_spoke",[w(e.caller)])}function to(e,t){return pt(e,"revoke_role_immediate",[w(t.account),I(t.role)])}function oo(e){return pt(e,"pause",[])}function ro(e){return pt(e,"unpause",[])}const ao=e=>e.toXDR("base64"),no=e=>i.ScVal.fromXDR(e,"base64"),so=e=>e.map((e=>String(s(no(e))))).join(":"),io=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),uo=e=>Number(e),lo=e=>String(e),co=e=>null==e?void 0:io(e),po=e=>null==e?void 0:lo(e),mo=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),fo=["None","Multiply","Long","Short"],ho=["Single","PrimaryWithAnchor"],_o=["ReflectorSep40","RedStonePriceFeed"],bo=["Spot","Twap"],wo=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd"],go=e=>Array.isArray(e)?e:[],yo=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],wo[uo(r)]??io(r)),positionType:t,hubId:uo(e[1]),asset:lo(e[2]),scaledAmountRay:io(e[3]),indexRay:io(e[4]),amount:io(e[5]),liquidationThresholdBps:o?void 0:uo(e[6]),liquidationBonusBps:o?void 0:uo(e[7]),loanToValueBps:o?void 0:uo(e[8]),liquidationFeesBps:o?void 0:uo(e[9])};var r},vo=e=>{return{owner:lo(e[0]),spokeId:uo(e[1]),mode:(t=e[2],fo[uo(t)]??"None")};var t},So=(e,t)=>{const o=bo[uo(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:lo(r)}:null!=a?{kind:"Symbol",value:lo(a)}:void 0;return{provider:_o[uo(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:lo(e[`${t}_contract`]),asset:n,feedId:po(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?uo(e[`${t}_twap_records`]):void 0,decimals:uo(e[`${t}_decimals`]),resolutionSeconds:uo(e[`${t}_resolution_seconds`]),maxStaleSeconds:uo(e[`${t}_max_stale_seconds`])}},ko=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:lo(e.base_token_id),quoteTokenId:lo(e.quote_token_id),tolerance:{upperRatio:uo(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:uo(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:uo(e.asset_decimals),maxPriceStaleSeconds:uo(e.max_price_stale_seconds),strategy:ho[uo(e.strategy)]??"Single",primary:So(e,"primary"),anchor:t?So(e,"anchor"):void 0,primaryQuoteToken:po(e.primary_quote_token),anchorQuoteToken:po(e.anchor_quote_token),minSanityPriceWad:co(e.min_sanity_price_wad),maxSanityPriceWad:co(e.max_sanity_price_wad)}},Io={"market:create":e=>({topic:"market:create",data:{hubId:uo(e.hub_id),baseAsset:lo(e.base_asset),maxBorrowRate:io(e.max_borrow_rate),baseBorrowRate:io(e.base_borrow_rate),slope1:io(e.slope1),slope2:io(e.slope2),slope3:io(e.slope3),midUtilization:io(e.mid_utilization),optimalUtilization:io(e.optimal_utilization),maxUtilization:io(e.max_utilization),reserveFactor:uo(e.reserve_factor),marketAddress:lo(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:lo(e.asset),maxBorrowRateRay:io(e.max_borrow_rate),baseBorrowRateRay:io(e.base_borrow_rate),slope1Ray:io(e.slope1),slope2Ray:io(e.slope2),slope3Ray:io(e.slope3),midUtilizationRay:io(e.mid_utilization),optimalUtilizationRay:io(e.optimal_utilization),maxUtilizationRay:io(e.max_utilization),reserveFactorBps:uo(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:go(e).map((e=>{return t=go(e),{hubId:uo(t[0]),asset:lo(t[1]),timestamp:uo(t[2]),supplyIndexRay:io(t[3]),borrowIndexRay:io(t[4]),cash:io(t[5]),suppliedRay:io(t[6]),borrowedRay:io(t[7]),revenueRay:io(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:go(e).map((e=>{const t=e;return{hubId:uo(t.hub_id),asset:lo(t.asset),params:(o=t.params,{maxBorrowRateRay:io(o.max_borrow_rate),baseBorrowRateRay:io(o.base_borrow_rate),slope1Ray:io(o.slope1),slope2Ray:io(o.slope2),slope3Ray:io(o.slope3),midUtilizationRay:io(o.mid_utilization),optimalUtilizationRay:io(o.optimal_utilization),maxUtilizationRay:io(o.max_utilization),reserveFactorBps:uo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:uo(o.flashloan_fee),assetId:lo(o.asset_id),assetDecimals:uo(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=go(e);return{topic:"position:batch_update",data:{accountId:io(t[0]),accountAttributes:vo(go(t[1])),updates:[...go(t[2]).map((e=>yo(go(e),"Deposit"))),...go(t[3]).map((e=>yo(go(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:uo(e.hub_id),asset:lo(e.asset),receiver:lo(e.receiver),caller:lo(e.caller),amount:io(e.amount),fee:io(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:lo(e.asset),oracle:ko(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:lo(e.liquidator),accountId:io(e.account_id),repaidUsdWad:io(e.repaid_usd_wad),bonusBps:io(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:io(e.account_id),totalBorrowUsdWad:io(e.total_borrow_usd_wad),totalCollateralUsdWad:io(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:lo(e.token),amount:io(e.amount),usdValueWad:io(e.usd_value_wad),accountId:io(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:uo(e.hub_id),asset:lo(e.asset),amount:io(e.amount),fee:io(e.fee),amountSent:io(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:mo(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:lo(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:lo(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:mo(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:uo(e.max_supply_positions),maxBorrowPositions:uo(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:lo(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:uo(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:io(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:io(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:uo(t.liquidation_bonus_factor_bps)}}}},Ro=Object.freeze(Object.keys(Io));function To(e,t){const o=so(e),r=Io[o];return r?r(s(no(t))):null}const xo="XLENDXLM-a7c9f3",Ao=1e4;function Eo(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${xo}-${o}`}function $o(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Bo(e,t=0){return 1e4*e+t}function No(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Oo=(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()},Po=e=>e.baseUrl??d[e.network];async function Uo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Oo(Po(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 qo(e){const t=Oo(Po(e),"api/v1/tokens"),o=await fetch(t,e.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${t} — ${e}`)}return await o.json()}const Lo=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,zo=e=>O(e).toXDR("base64");function Vo(t,a){const s=t.routerAddress??h(t.network),i=new r(s),u=new e(t.caller,t.sourceSequence),l=L(Lo(a,t.referralId));return{xdr:new n(u,{fee:t.fee??o,networkPassphrase:m[t.network]}).addOperation(i.call("execute_strategy",w(t.caller),g(t.totalIn),l)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function Wo(e,t){return Vo(e,t)}function Do(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(Xo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Xo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Co(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Do(e,t)}const Go=Do,Xo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Fo(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Mo(e,t,o){const r=n.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Fo(o.invokedContractId,e);throw e}}async function Ho(e,t,o){return Mo(e,t.xdr,o)}function jo(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 Qo(e,t){return new Uint8Array(0)}const Zo=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 Jo(t){const o=new e(t.caller,t.sourceSequence),a=new r(t.forwarderAddress).call("mint_and_forward",i.ScVal.scvBytes(Zo(t.message)),i.ScVal.scvBytes(Zo(t.attestation)));return{xdr:new n(o,{fee:t.fee??"10000000",networkPassphrase:m[t.network]}).addOperation(a).setTimeout(t.timeoutSeconds??120).build().toXDR()}}const Ko={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function Yo(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const o=Number(t[1]),r=Ko[o];return r?{code:o,...r}:null}export{l as STELLAR_AGGREGATOR_ROUTER,c as STELLAR_GOVERNANCE,nt as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,u as STELLAR_LENDING_CONTROLLER,Ro as STELLAR_LENDING_TOPICS,m as STELLAR_NETWORK_PASSPHRASE,d as STELLAR_QUOTE_URL,p as STELLAR_SOROBAN_RPC_URL,Ao as SYNTHETIC_EVENT_ORDER_STRIDE,xo as XOXNO_LENDING_STELLAR_TICKER,Qo as buildSameTokenRepaySwapSteps,De as buildStellarAcceptOwnershipTx,rt as buildStellarAddRewardsTx,Me as buildStellarApproveTokenTx,Wo as buildStellarBatchSwapTx,C as buildStellarBorrowBatchTx,G as buildStellarBorrowTx,Jo as buildStellarCctpForwardTx,ot as buildStellarClaimRevenueTx,et as buildStellarCreateLiquidityPoolTx,Vo as buildStellarExecuteStrategyTx,Q as buildStellarFlashLoanTx,eo as buildStellarGovernanceAddSpokeImmediateTx,Yt as buildStellarGovernanceCreateHubImmediateTx,Mt as buildStellarGovernanceExecuteGovernanceUpgradeTx,jt as buildStellarGovernanceExecuteGrantGovernanceRoleTx,Qt as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,Zt as buildStellarGovernanceExecuteTransferGovOwnTx,Ft as buildStellarGovernanceExecuteTx,Ht as buildStellarGovernanceExecuteUpdateDelayTx,oo as buildStellarGovernancePauseTx,to as buildStellarGovernanceRevokeRoleImmediateTx,Kt as buildStellarGovernanceSetOracleSanityBoundsImmediateTx,Jt as buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,ro as buildStellarGovernanceUnpauseTx,ze as buildStellarGrantRoleTx,Eo as buildStellarLendingIdentifier,j as buildStellarLiquidateTx,Z as buildStellarMigrateFromBlendTx,Ue as buildStellarMigrateTx,J as buildStellarMultiplyTx,qe as buildStellarPauseTx,vt as buildStellarProposeAddAssetToSpokeTx,gt as buildStellarProposeAddSpokeTx,Et as buildStellarProposeApproveBlendPoolTx,xt as buildStellarProposeApproveTokenTx,zt as buildStellarProposeConfigureMarketOracleTx,wt as buildStellarProposeCreateHubTx,Bt as buildStellarProposeCreateLiquidityPoolTx,Ot as buildStellarProposeDeployPoolTx,St as buildStellarProposeEditAssetInSpokeTx,Vt as buildStellarProposeEditOracleToleranceTx,Wt as buildStellarProposeGovernanceUpgradeTx,Ct as buildStellarProposeGrantGovernanceRoleTx,qt as buildStellarProposeMigrateControllerTx,kt as buildStellarProposeRemoveAssetFromSpokeTx,yt as buildStellarProposeRemoveSpokeTx,$t as buildStellarProposeRevokeBlendPoolTx,Gt as buildStellarProposeRevokeGovernanceRoleTx,At as buildStellarProposeRevokeTokenTx,ht as buildStellarProposeSetAccumulatorTx,ft as buildStellarProposeSetAggregatorTx,Tt as buildStellarProposeSetMinBorrowCollatTx,_t as buildStellarProposeSetPoolTemplateTx,bt as buildStellarProposeSetPositionLimitsTx,Rt as buildStellarProposeSetPositionManagerTx,It as buildStellarProposeSetSpokeLiquidationCurveTx,Lt as buildStellarProposeTransferCtrlOwnershipTx,Xt as buildStellarProposeTransferGovOwnTx,Dt as buildStellarProposeUpdateDelayTx,Ut as buildStellarProposeUpgradeControllerTx,Nt as buildStellarProposeUpgradePoolParamsTx,Pt as buildStellarProposeUpgradePoolTx,Ye as buildStellarRenewAccountTx,M as buildStellarRepayBatchTx,ee as buildStellarRepayDebtWithCollateralTx,H as buildStellarRepayTx,Ve as buildStellarRevokeRoleTx,He as buildStellarRevokeTokenTx,Ge as buildStellarSetAccumulatorTx,Ce as buildStellarSetAggregatorTx,Xe as buildStellarSetLiquidityPoolTemplateTx,je as buildStellarSetMarketOracleConfigTx,Je as buildStellarSetOracleSanityBoundsTx,Qe as buildStellarSetOracleToleranceTx,Fe as buildStellarSetPositionLimitsTx,Ze as buildStellarSetSpokeAssetFlagsTx,W as buildStellarSupplyBatchTx,D as buildStellarSupplyTx,Y as buildStellarSwapCollateralTx,K as buildStellarSwapDebtTx,We as buildStellarTransferOwnershipTx,Le as buildStellarUnpauseTx,at as buildStellarUpdateAccountThresholdTx,Ke as buildStellarUpdateIndexesTx,Pe as buildStellarUpgradeControllerTx,tt as buildStellarUpgradeLiquidityPoolParamsTx,X as buildStellarWithdrawBatchTx,F as buildStellarWithdrawTx,V as buildTx,To as decodeStellarLendingEvent,xe as encodeInterestRateModel,Oe as encodeMarketOracleConfigInput,Ae as encodeMarketParamsRaw,Ne as encodeOracleSourceConfigInput,Ee as encodePositionLimits,zo as encodeStrategyPayloadToRouteXdr,$o as extractEventOrder,we as getStellarAccountPositions,Uo as getStellarAggregatorQuote,h as getStellarAggregatorRouter,pe as getStellarAsset,ye as getStellarAssetGraph,me as getStellarAssetMarkets,de as getStellarAssetPage,ne as getStellarAssets,_ as getStellarGovernance,ge as getStellarGovernanceProposals,fe as getStellarHub,ve as getStellarHubGraph,se as getStellarHubs,ae as getStellarLendingContext,f as getStellarLendingController,qo as getStellarQuoteTokens,le as getStellarReserve,ke as getStellarReserveGraph,ce as getStellarReserveHolders,ue as getStellarReserves,he as getStellarSpoke,Se as getStellarSpokeGraph,ie as getStellarSpokes,be as getStellarUserActivity,_e as getStellarUserPositions,Go as mapQuoteResponseToAggregatorSwap,Do as mapQuoteResponseToStrategyPayload,Co as mapQuoteResponseToStrategySwap,Yo as mapSorobanError,No as mapStellarPositionActivityType,Ho as prepareStellarBuiltTx,Mo as prepareStellarTxXdr,so as stellarLendingDispatchKey,Ie as stellarLendingRead,Bo as syntheticEventOrder,Fo as tagStellarInvokedContractError,ao as toBase64Xdr,jo as toStellarPositionMode};
|
|
1
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as e,Address as t,BASE_FEE as o,Contract as r,ScInt as a,TransactionBuilder as n,scValToNative as s,xdr as i}from"@stellar/stellar-sdk";const u={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},l={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},c={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},d={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},p={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},m={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function f(e){const t=u[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 h(e){const t=l[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 _(e){const t=c[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const b=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],w=e=>new t(e).toScVal(),g=e=>new a(e).toI128(),y=e=>i.ScVal.scvU32(e),v=e=>new a("string"==typeof e?e:e.toString()).toU64(),S=e=>i.ScVal.scvBool(e),k=e=>i.ScVal.scvString(e),R=e=>i.ScVal.scvSymbol(e),I=()=>i.ScVal.scvVoid(),T=e=>i.ScVal.scvVec(e),x=(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 i.ScVal.scvBytes(r)},A=(e,t)=>null==e?I():t(e),$=(e,t)=>N({asset:w(t),hub_id:y(e)}),E=(e,t,o)=>i.ScVal.scvVec([$(e,t),g(o)]),B=e=>i.ScVal.scvVec(e.map((e=>E(e.hubId,e.asset,e.amount)))),N=e=>{const t=Object.keys(e).sort().map((t=>new i.ScMapEntry({key:R(t),val:e[t]})));return i.ScVal.scvMap(t)},O=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return N({amount_out:g(e.amountOut),pool:w(e.pool),token_in:w(e.tokenIn),token_out:w(e.tokenOut),venue:(t=e.venue,i.ScVal.scvVec([R(t)]))});var t}));return N({hops:i.ScVal.scvVec(t),split_ppm:y(e.splitPpm)})}));return N({paths:i.ScVal.scvVec(t),referral_id:v(e.referralId??0),token_in:w(e.tokenIn),token_out:w(e.tokenOut),total_min_out:g(e.totalMinOut)})},P=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 i.ScVal.scvBytes(t)},U=()=>i.ScVal.scvBytes(Buffer.alloc(0)),q=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},L=e=>{if("string"==typeof e)return P(q(e));if(e instanceof Uint8Array)return 0===e.length?U():P(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?P(q(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(q(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(q(e.bytes)):0===e.bytes.length?U():P(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||!b.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),i.ScVal.scvBytes(Buffer.from(O(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},W=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return i.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return i.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function z(t,a,s){const i=t.controllerAddress??f(t.network),u=new r(i),l=new e(t.caller,t.sourceSequence);return{xdr:new n(l,{fee:t.fee??o,networkPassphrase:m[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function V(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return z(e,"supply",[w(e.caller),v(o),y(r),B([...t.assets])])}function D(e,t){return V(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function C(e,t){return z(e,"borrow",[w(e.caller),v(t.accountNonce),B([...t.borrows]),A(t.to,w)])}function G(e,t){return C(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function X(e,t){return z(e,"withdraw",[w(e.caller),v(t.accountNonce),B([...t.withdrawals]),A(t.to,w)])}function F(e,t){return X(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function M(e,t){return z(e,"repay",[w(e.caller),v(t.accountNonce),B([...t.payments])])}function H(e,t){return M(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function j(e,t){return z(e,"liquidate",[w(e.caller),v(t.accountNonce),B([...t.debtPayments])])}function Q(e,t){return z(e,"flash_loan",[w(e.caller),$(t.hubId,t.asset),g(t.amount),w(t.receiver),W(t.data)])}function Z(e,t){return z(e,"migrate_from_blend",[w(e.caller),v(t.accountId),y(t.spokeId),y(t.hubId),w(t.blendPool),T(t.collateralTokens.map(w)),T(t.supplyTokens.map(w)),(o=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),i.ScVal.scvVec(o.map((e=>{return t=e.token,o=e.amount,i.ScVal.scvVec([w(t),g(o)]);var t,o}))))]);var o}function J(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return z(e,"multiply",[w(e.caller),v(o),y(r),$(t.collateral.hubId,t.collateral.asset),g(t.debtToFlashLoan),$(t.debt.hubId,t.debt.asset),y(t.mode),L(t.steps),A(t.initialPayment,(e=>E(e.hubId,e.asset,e.amount))),A(t.convertSwap,L)])}function K(e,t){return z(e,"swap_debt",[w(e.caller),v(t.accountNonce),$(t.existingDebt.hubId,t.existingDebt.asset),g(t.newDebtAmount),$(t.newDebt.hubId,t.newDebt.asset),L(t.steps)])}function Y(e,t){return z(e,"swap_collateral",[w(e.caller),v(t.accountNonce),$(t.current.hubId,t.current.asset),g(t.fromAmount),$(t.newCollateral.hubId,t.newCollateral.asset),L(t.steps)])}function ee(e,t){return z(e,"repay_debt_with_collateral",[w(e.caller),v(t.accountNonce),$(t.collateral.hubId,t.collateral.asset),g(t.collateralAmount),$(t.debt.hubId,t.debt.asset),L(t.steps),S(t.closePosition)])}const te="/stellar-lending",oe=25,re=encodeURIComponent,ae=(e,t)=>e.fetchWithTimeout(`${te}/context`,t),ne=(e,t)=>e.fetchWithTimeout(`${te}/live-state`,t),se=(e,t)=>e.fetchWithTimeout(`${te}/assets`,t),ie=(e,t)=>e.fetchWithTimeout(`${te}/hubs`,t),ue=(e,t)=>e.fetchWithTimeout(`${te}/spokes`,t),le=(e,t={},o)=>{const{hubId:r,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${te}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ce=(e,t,o,r,a)=>e.fetchWithTimeout(`${te}/reserves/${t}/${o}/${re(r)}`,a),de=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${te}/reserves/${t}/${o}/${re(r)}/holders`,{...n,params:{side:a}}),pe=(e,t,o)=>e.fetchWithTimeout(`${te}/assets/${re(t)}`,o),me=(e,t,o,r)=>e.fetchWithTimeout(`${te}/assets/${re(t)}/page`,{...r,params:{...o}}),fe=(e,t,o,r)=>e.fetchWithTimeout(`${te}/assets/${re(t)}/markets`,{...r,params:{side:o}}),he=(e,t,o)=>e.fetchWithTimeout(`${te}/hubs/${t}`,o),_e=(e,t,o)=>e.fetchWithTimeout(`${te}/spokes/${t}`,o),be=(e,t,o)=>e.fetchWithTimeout(`${te}/users/${re(t)}/positions`,o),we=(e,t,o={},r)=>{const{skip:a,top:n}=o;return e.fetchWithTimeout(`${te}/users/${re(t)}/activity`,{...r,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},ge=(e,t,o)=>e.fetchWithTimeout(`${te}/accounts/${re(t)}/positions`,o),ye=(e,t={},o)=>{const{top:r=oe,continuationToken:a}=t;return e.fetchWithTimeout(`${te}/governance/proposals`,{...o,params:{top:r,...a?{continuationToken:a}:{}}})},ve=(e,t,o,r)=>e.fetchWithTimeout(`${te}/assets/${re(t)}/graph`,{...r,params:{...o}}),Se=(e,t,o,r)=>e.fetchWithTimeout(`${te}/hubs/${t}/graph`,{...r,params:{...o}}),ke=(e,t,o,r)=>e.fetchWithTimeout(`${te}/spokes/${t}/graph`,{...r,params:{...o}}),Re=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${te}/reserves/${t}/${o}/${re(r)}/graph`,{...n,params:{...a}}),Ie=e=>({context:t=>ae(e,t),liveState:t=>ne(e,t),assets:t=>se(e,t),hubs:t=>ie(e,t),spokes:t=>ue(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?le(e,t,o):le(e,{},t);var r},reserve:(t,o,r,a)=>ce(e,t,o,r,a),reserveHolders:(t,o,r,a,n)=>de(e,t,o,r,a,n),asset:(t,o)=>pe(e,t,o),assetMarkets:(t,o,r)=>fe(e,t,o,r),hub:(t,o)=>he(e,t,o),spoke:(t,o)=>_e(e,t,o),userPositions:(t,o)=>be(e,t,o),userActivity:(t,o,r)=>we(e,t,o,r),accountPositions:(t,o)=>ge(e,t,o),governanceProposals:(t,o)=>ye(e,t,o),assetGraph:(t,o,r)=>ve(e,t,o,r),hubGraph:(t,o,r)=>Se(e,t,o,r),spokeGraph:(t,o,r)=>ke(e,t,o,r),reserveGraph:(t,o,r,a,n)=>Re(e,t,o,r,a,n)}),Te={Single:0,PrimaryWithAnchor:1},xe="RedStonePriceFeed",Ae=e=>N({base_borrow_rate:g(e.baseBorrowRateRay),max_borrow_rate:g(e.maxBorrowRateRay),max_utilization:g(e.maxUtilizationRay),mid_utilization:g(e.midUtilizationRay),optimal_utilization:g(e.optimalUtilizationRay),reserve_factor:y(e.reserveFactorBps),slope1:g(e.slope1Ray),slope2:g(e.slope2Ray),slope3:g(e.slope3Ray)}),$e=e=>N({asset_decimals:y(e.assetDecimals),asset_id:w(e.assetId),base_borrow_rate:g(e.baseBorrowRateRay),flashloan_fee:y(e.flashloanFeeBps),is_flashloanable:S(e.isFlashloanable),max_borrow_rate:g(e.maxBorrowRateRay),max_utilization:g(e.maxUtilizationRay),mid_utilization:g(e.midUtilizationRay),optimal_utilization:g(e.optimalUtilizationRay),reserve_factor:y(e.reserveFactorBps),slope1:g(e.slope1Ray),slope2:g(e.slope2Ray),slope3:g(e.slope3Ray)}),Ee=e=>N({max_borrow_positions:y(e.maxBorrowPositions),max_supply_positions:y(e.maxSupplyPositions)}),Be=e=>{const t=e.kind;switch(t){case"Stellar":return T([R("Stellar"),w(e.value)]);case"Symbol":return T([R("Symbol"),R(e.value)]);case"String":return T([R("String"),k(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Ne=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return T([R("Twap"),y(t)])}return T([R("Spot")])},Oe=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return T([R("Reflector"),N({asset:Be(e.asset),contract:w(e.contract),read_mode:Ne(e.readMode,e.twapRecords)})])}if(t===xe||"XoxnoPriceFeed"===t){const o=t===xe?"RedStone":"Xoxno";if("string"!=typeof e.feedId)throw new Error(`Stellar builder: ${o} oracle source requires \`feedId\``);if("number"!=typeof e.maxStaleSeconds)throw new Error(`Stellar builder: ${o} oracle source requires \`maxStaleSeconds\``);return T([R(o),N({contract:w(e.contract),feed_id:k(e.feedId),max_stale_seconds:v(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Pe=e=>{const t=Te[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return N({anchor:(o=e.anchor,T(null==o?[R("None")]:[R("Some"),Oe(o)])),max_price_stale_seconds:v(e.maxPriceStaleSeconds),max_sanity_price_wad:g(e.maxSanityPriceWad),min_sanity_price_wad:g(e.minSanityPriceWad),primary:Oe(e.primary),strategy:y(t),tolerance_bps:y(e.toleranceBps)});var o};function Ue(e,t){return z(e,"upgrade",[x(t.wasmHash)])}function qe(e,t){return z(e,"migrate",[y(t.newVersion)])}function Le(e){return z(e,"pause",[])}function We(e){return z(e,"unpause",[])}function ze(e,t){return z(e,"grant_role",[w(t.account),R(t.role)])}function Ve(e,t){return z(e,"revoke_role",[w(t.account),R(t.role)])}function De(e,t){return z(e,"transfer_ownership",[w(t.newOwner),y(t.liveUntilLedger)])}function Ce(e){return z(e,"accept_ownership",[])}function Ge(e,t){return z(e,"set_aggregator",[w(t.aggregator)])}function Xe(e,t){return z(e,"set_accumulator",[w(t.accumulator)])}function Fe(e,t){return z(e,"set_liquidity_pool_template",[x(t.wasmHash)])}function Me(e,t){return z(e,"set_position_limits",[Ee(t)])}function He(e,t){return z(e,"approve_token",[w(t.token)])}function je(e,t){return z(e,"revoke_token",[w(t.token)])}function Qe(e,t){return z(e,"set_market_oracle_config",[$(t.hubId,t.asset),Pe(t.config)])}function Ze(e,t){return z(e,"set_oracle_tolerance",[w(t.asset),N({lower_ratio_bps:y(t.lowerRatioBps),upper_ratio_bps:y(t.upperRatioBps)})])}function Je(e,t){return z(e,"set_spoke_asset_flags",[y(t.spokeId),$(t.hubId,t.asset),S(t.paused),S(t.frozen)])}function Ke(e,t){return z(e,"set_oracle_sanity_bounds",[w(t.asset),g(t.minPriceWad),g(t.maxPriceWad)])}function Ye(e,t){return z(e,"update_indexes",[w(e.caller),T(t.assets.map((e=>$(e.hubId,e.asset))))])}function et(e,t){return z(e,"renew_account",[w(e.caller),v(t.accountNonce)])}function tt(e,t){return z(e,"create_liquidity_pool",[y(t.hubId),w(t.asset),$e(t.params)])}function ot(e,t){return z(e,"upgrade_liquidity_pool_params",[$(t.hubId,t.asset),Ae(t.params)])}function rt(e,t){return z(e,"claim_revenue",[w(e.caller),T(t.assets.map((e=>$(e.hubId,e.asset))))])}function at(e,t){return z(e,"add_rewards",[w(e.caller),B(t.rewards)])}function nt(e,t){return z(e,"update_account_threshold",[w(e.caller),S(t.hasRisks),T(t.accountNonces.map((e=>v(e))))])}const st="00".repeat(32),it=e=>{if("string"==typeof e)return x(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 i.ScVal.scvBytes(t)},ut=(e,...t)=>T([R(e),...t]),lt=e=>N({new_owner:w(e.newOwner),live_until_ledger:y(e.liveUntilLedger)}),ct=e=>N({asset:w(e.asset),bonus:y(e.bonus),borrow_cap:g(e.borrowCap),can_borrow:S(e.canBorrow),can_collateral:S(e.canCollateral),frozen:S(e.frozen),hub_id:y(e.hubId),paused:S(e.paused),liquidation_fees:y(e.liquidationFees),ltv:y(e.ltv),oracle_override:T([R("None")]),spoke_id:y(e.spokeId),supply_cap:g(e.supplyCap),threshold:y(e.threshold)}),dt=e=>N({account:w(e.account),role:R(e.role)});function pt(t,a,s){const i=t.governanceAddress??_(t.network),u=new r(i),l=new e(t.caller,t.sourceSequence);return{xdr:new n(l,{fee:t.fee??o,networkPassphrase:m[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const mt=(e,t,o)=>pt(e,"propose",[w(e.caller),t,it(o)]),ft=(e,t,o)=>pt(e,"execute_self",[I(),t,it(o)]);function ht(e,t,o){return mt(e,ut("SetAggregator",w(t.aggregator)),o)}function _t(e,t,o){return mt(e,ut("SetAccumulator",w(t.accumulator)),o)}function bt(e,t,o){return mt(e,ut("SetLiquidityPoolTemplate",x(t.wasmHash)),o)}function wt(e,t,o){return mt(e,ut("SetPositionLimits",Ee(t)),o)}function gt(e,t){return mt(e,ut("CreateHub"),t)}function yt(e,t){return mt(e,ut("AddSpoke"),t)}function vt(e,t,o){return mt(e,ut("RemoveSpoke",y(t.spokeId)),o)}function St(e,t,o){return mt(e,ut("AddAssetToSpoke",ct(t)),o)}function kt(e,t,o){return mt(e,ut("EditAssetInSpoke",ct(t)),o)}function Rt(e,t,o){return mt(e,ut("RemoveAssetFromSpoke",N({hub_asset:$((r=t).hubId,r.asset),spoke_id:y(r.spokeId)})),o);var r}function It(e,t,o){return mt(e,ut("SetSpokeLiquidationCurve",N({hf_for_max_bonus_wad:g((r=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:y(r.liquidationBonusFactorBps),spoke_id:y(r.spokeId),target_hf_wad:g(r.targetHfWad)})),o);var r}function Tt(e,t,o){return mt(e,ut("SetPositionManager",w(t.manager),S(t.isActive)),o)}function xt(e,t,o){return mt(e,ut("SetMinBorrowCollateralUsd",g(t.floorWad)),o)}function At(e,t,o){return mt(e,ut("ApproveToken",w(t.token)),o)}function $t(e,t,o){return mt(e,ut("RevokeToken",w(t.token)),o)}function Et(e,t,o){return mt(e,ut("ApproveBlendPool",w(t.pool)),o)}function Bt(e,t,o){return mt(e,ut("RevokeBlendPool",w(t.pool)),o)}function Nt(e,t,o){return mt(e,ut("CreateLiquidityPool",N({asset:w((r=t).asset),hub_id:y(r.hubId),params:$e(r.params)})),o);var r}function Ot(e,t,o){return mt(e,ut("UpgradeLiquidityPoolParams",N({hub_asset:$((r=t).hubId,r.asset),params:Ae(r.params)})),o);var r}function Pt(e,t){return mt(e,ut("DeployPool"),t)}function Ut(e,t,o){return mt(e,ut("UpgradePool",x(t.wasmHash)),o)}function qt(e,t,o){return mt(e,ut("UpgradeController",x(t.wasmHash)),o)}function Lt(e,t,o){return mt(e,ut("MigrateController",y(t.newVersion)),o)}function Wt(e,t,o){return mt(e,ut("TransferCtrlOwnership",lt(t)),o)}function zt(e,t,o){return mt(e,ut("ConfigureMarketOracle",N({cfg:Pe((r=t).config),hub_asset:$(r.hubId,r.asset)})),o);var r}function Vt(e,t,o){return mt(e,ut("EditOracleTolerance",N({asset:w((r=t).asset),tolerance:y(r.tolerance)})),o);var r}function Dt(e,t,o){return mt(e,ut("UpgradeGov",x(t.wasmHash)),o)}function Ct(e,t,o){return mt(e,ut("UpdateGovDelay",y(t.newDelay)),o)}function Gt(e,t,o){return mt(e,ut("GrantGovRole",dt(t)),o)}function Xt(e,t,o){return mt(e,ut("RevokeGovRole",dt(t)),o)}function Ft(e,t,o){return mt(e,ut("TransferGovOwnership",lt(t)),o)}function Mt(e,t){const o=T(t.argsXdr.map((e=>i.ScVal.fromXDR(e,"base64")))),r=it(t.predecessor??st);return pt(e,"execute",[I(),w(t.target),R(t.functionName),o,r,it(t.salt)])}function Ht(e,t,o){return ft(e,ut("UpgradeGov",x(t.wasmHash)),o)}function jt(e,t,o){return ft(e,ut("UpdateGovDelay",y(t.newDelay)),o)}function Qt(e,t,o){return ft(e,ut("GrantGovRole",dt(t)),o)}function Zt(e,t,o){return ft(e,ut("RevokeGovRole",dt(t)),o)}function Jt(e,t,o){return ft(e,ut("TransferGovOwnership",lt(t)),o)}function Kt(e,t){return pt(e,"set_spoke_asset_flags",[w(e.caller),y(t.spokeId),$(t.hubId,t.asset),S(t.paused),S(t.frozen)])}function Yt(e,t){return pt(e,"set_oracle_sanity_bounds",[w(e.caller),w(t.asset),g(t.minPriceWad),g(t.maxPriceWad)])}function eo(e){return pt(e,"create_hub",[w(e.caller)])}function to(e){return pt(e,"add_spoke",[w(e.caller)])}function oo(e,t){return pt(e,"revoke_role_immediate",[w(t.account),R(t.role)])}function ro(e){return pt(e,"pause",[w(e.caller)])}function ao(e,t){return mt(e,ut("Unpause"),t)}const no=e=>e.toXDR("base64"),so=e=>i.ScVal.fromXDR(e,"base64"),io=e=>e.map((e=>String(s(so(e))))).join(":"),uo=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),lo=e=>Number(e),co=e=>String(e),po=e=>null==e?void 0:uo(e),mo=e=>null==e?void 0:co(e),fo=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),ho=["None","Multiply","Long","Short"],_o=["Single","PrimaryWithAnchor"],bo=["ReflectorSep40","RedStonePriceFeed"],wo=["Spot","Twap"],go=["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"],yo=e=>Array.isArray(e)?e:[],vo=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],go[lo(r)]??uo(r)),positionType:t,hubId:lo(e[1]),asset:co(e[2]),scaledAmountRay:uo(e[3]),indexRay:uo(e[4]),amount:uo(e[5]),liquidationThresholdBps:o?void 0:lo(e[6]),liquidationBonusBps:o?void 0:lo(e[7]),loanToValueBps:o?void 0:lo(e[8]),liquidationFeesBps:o?void 0:lo(e[9])};var r},So=e=>{return{owner:co(e[0]),spokeId:lo(e[1]),mode:(t=e[2],ho[lo(t)]??"None")};var t},ko=(e,t)=>{const o=wo[lo(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:co(r)}:null!=a?{kind:"Symbol",value:co(a)}:void 0;return{provider:bo[lo(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:co(e[`${t}_contract`]),asset:n,feedId:mo(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?lo(e[`${t}_twap_records`]):void 0,decimals:lo(e[`${t}_decimals`]),resolutionSeconds:lo(e[`${t}_resolution_seconds`]),maxStaleSeconds:lo(e[`${t}_max_stale_seconds`])}},Ro=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:co(e.base_token_id),quoteTokenId:co(e.quote_token_id),tolerance:{upperRatio:lo(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:lo(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:lo(e.asset_decimals),maxPriceStaleSeconds:lo(e.max_price_stale_seconds),strategy:_o[lo(e.strategy)]??"Single",primary:ko(e,"primary"),anchor:t?ko(e,"anchor"):void 0,primaryQuoteToken:mo(e.primary_quote_token),anchorQuoteToken:mo(e.anchor_quote_token),minSanityPriceWad:po(e.min_sanity_price_wad),maxSanityPriceWad:po(e.max_sanity_price_wad)}},Io={"market:create":e=>({topic:"market:create",data:{hubId:lo(e.hub_id),baseAsset:co(e.base_asset),maxBorrowRate:uo(e.max_borrow_rate),baseBorrowRate:uo(e.base_borrow_rate),slope1:uo(e.slope1),slope2:uo(e.slope2),slope3:uo(e.slope3),midUtilization:uo(e.mid_utilization),optimalUtilization:uo(e.optimal_utilization),maxUtilization:uo(e.max_utilization),reserveFactor:lo(e.reserve_factor),marketAddress:co(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:co(e.asset),maxBorrowRateRay:uo(e.max_borrow_rate),baseBorrowRateRay:uo(e.base_borrow_rate),slope1Ray:uo(e.slope1),slope2Ray:uo(e.slope2),slope3Ray:uo(e.slope3),midUtilizationRay:uo(e.mid_utilization),optimalUtilizationRay:uo(e.optimal_utilization),maxUtilizationRay:uo(e.max_utilization),reserveFactorBps:lo(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:yo(e).map((e=>{return t=yo(e),{hubId:lo(t[0]),asset:co(t[1]),timestamp:lo(t[2]),supplyIndexRay:uo(t[3]),borrowIndexRay:uo(t[4]),cash:uo(t[5]),suppliedRay:uo(t[6]),borrowedRay:uo(t[7]),revenueRay:uo(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:yo(e).map((e=>{const t=e;return{hubId:lo(t.hub_id),asset:co(t.asset),params:(o=t.params,{maxBorrowRateRay:uo(o.max_borrow_rate),baseBorrowRateRay:uo(o.base_borrow_rate),slope1Ray:uo(o.slope1),slope2Ray:uo(o.slope2),slope3Ray:uo(o.slope3),midUtilizationRay:uo(o.mid_utilization),optimalUtilizationRay:uo(o.optimal_utilization),maxUtilizationRay:uo(o.max_utilization),reserveFactorBps:lo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:lo(o.flashloan_fee),assetId:co(o.asset_id),assetDecimals:lo(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=yo(e);return{topic:"position:batch_update",data:{accountId:uo(t[0]),accountAttributes:So(yo(t[1])),updates:[...yo(t[2]).map((e=>vo(yo(e),"Deposit"))),...yo(t[3]).map((e=>vo(yo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:lo(e.hub_id),asset:co(e.asset),receiver:co(e.receiver),caller:co(e.caller),amount:uo(e.amount),fee:uo(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:co(e.asset),oracle:Ro(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:co(e.liquidator),accountId:uo(e.account_id),repaidUsdWad:uo(e.repaid_usd_wad),bonusBps:uo(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:uo(e.account_id),totalBorrowUsdWad:uo(e.total_borrow_usd_wad),totalCollateralUsdWad:uo(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:co(e.token),amount:uo(e.amount),usdValueWad:uo(e.usd_value_wad),accountId:uo(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:lo(e.hub_id),asset:co(e.asset),amount:uo(e.amount),fee:uo(e.fee),amountSent:uo(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:fo(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:co(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:co(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:fo(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:lo(e.max_supply_positions),maxBorrowPositions:lo(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:co(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:lo(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:uo(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:uo(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:lo(t.liquidation_bonus_factor_bps)}}}},To=Object.freeze(Object.keys(Io));function xo(e,t){const o=io(e),r=Io[o];return r?r(s(so(t))):null}const Ao="XLENDXLM-a7c9f3",$o=1e4;function Eo(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${Ao}-${o}`}function Bo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function No(e,t=0){return 1e4*e+t}function Oo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Po=(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()},Uo=e=>e.baseUrl??p[e.network];async function qo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Po(Uo(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 Lo(e){const t=Po(Uo(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 Wo=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,zo=e=>O(e).toXDR("base64");function Vo(t,a){const s=t.routerAddress??h(t.network),i=new r(s),u=new e(t.caller,t.sourceSequence),l=L(Wo(a,t.referralId));return{xdr:new n(u,{fee:t.fee??o,networkPassphrase:m[t.network]}).addOperation(i.call("execute_strategy",w(t.caller),g(t.totalIn),l)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function Do(e,t){return Vo(e,t)}function Co(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(Fo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Fo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Go(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Co(e,t)}const Xo=Co,Fo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Mo(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Ho(e,t,o){const r=n.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Mo(o.invokedContractId,e);throw e}}async function jo(e,t,o){return Ho(e,t.xdr,o)}function Qo(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 Zo(e,t){return new Uint8Array(0)}const Jo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(t,"hex")};function Ko(t){const o=new e(t.caller,t.sourceSequence),a=new r(t.forwarderAddress).call("mint_and_forward",i.ScVal.scvBytes(Jo(t.message)),i.ScVal.scvBytes(Jo(t.attestation)));return{xdr:new n(o,{fee:t.fee??"10000000",networkPassphrase:m[t.network]}).addOperation(a).setTimeout(t.timeoutSeconds??120).build().toXDR()}}const Yo={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function er(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const o=Number(t[1]),r=Yo[o];return r?{code:o,...r}:null}export{l as STELLAR_AGGREGATOR_ROUTER,c as STELLAR_GOVERNANCE,st as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,u as STELLAR_LENDING_CONTROLLER,To as STELLAR_LENDING_TOPICS,m as STELLAR_NETWORK_PASSPHRASE,p as STELLAR_QUOTE_URL,d as STELLAR_SOROBAN_RPC_URL,$o as SYNTHETIC_EVENT_ORDER_STRIDE,Ao as XOXNO_LENDING_STELLAR_TICKER,Zo as buildSameTokenRepaySwapSteps,Ce as buildStellarAcceptOwnershipTx,at as buildStellarAddRewardsTx,He as buildStellarApproveTokenTx,Do as buildStellarBatchSwapTx,C as buildStellarBorrowBatchTx,G as buildStellarBorrowTx,Ko as buildStellarCctpForwardTx,rt as buildStellarClaimRevenueTx,tt as buildStellarCreateLiquidityPoolTx,Vo as buildStellarExecuteStrategyTx,Q as buildStellarFlashLoanTx,to as buildStellarGovernanceAddSpokeImmediateTx,eo as buildStellarGovernanceCreateHubImmediateTx,Ht as buildStellarGovernanceExecuteGovernanceUpgradeTx,Qt as buildStellarGovernanceExecuteGrantGovernanceRoleTx,Zt as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,Jt as buildStellarGovernanceExecuteTransferGovOwnTx,Mt as buildStellarGovernanceExecuteTx,jt as buildStellarGovernanceExecuteUpdateDelayTx,ro as buildStellarGovernancePauseTx,oo as buildStellarGovernanceRevokeRoleImmediateTx,Yt as buildStellarGovernanceSetOracleSanityBoundsImmediateTx,Kt as buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,ze as buildStellarGrantRoleTx,Eo as buildStellarLendingIdentifier,j as buildStellarLiquidateTx,Z as buildStellarMigrateFromBlendTx,qe as buildStellarMigrateTx,J as buildStellarMultiplyTx,Le as buildStellarPauseTx,St as buildStellarProposeAddAssetToSpokeTx,yt as buildStellarProposeAddSpokeTx,Et as buildStellarProposeApproveBlendPoolTx,At as buildStellarProposeApproveTokenTx,zt as buildStellarProposeConfigureMarketOracleTx,gt as buildStellarProposeCreateHubTx,Nt as buildStellarProposeCreateLiquidityPoolTx,Pt as buildStellarProposeDeployPoolTx,kt as buildStellarProposeEditAssetInSpokeTx,Vt as buildStellarProposeEditOracleToleranceTx,Dt as buildStellarProposeGovernanceUpgradeTx,Gt as buildStellarProposeGrantGovernanceRoleTx,Lt as buildStellarProposeMigrateControllerTx,Rt as buildStellarProposeRemoveAssetFromSpokeTx,vt as buildStellarProposeRemoveSpokeTx,Bt as buildStellarProposeRevokeBlendPoolTx,Xt as buildStellarProposeRevokeGovernanceRoleTx,$t as buildStellarProposeRevokeTokenTx,_t as buildStellarProposeSetAccumulatorTx,ht as buildStellarProposeSetAggregatorTx,xt as buildStellarProposeSetMinBorrowCollatTx,bt as buildStellarProposeSetPoolTemplateTx,wt as buildStellarProposeSetPositionLimitsTx,Tt as buildStellarProposeSetPositionManagerTx,It as buildStellarProposeSetSpokeLiquidationCurveTx,Wt as buildStellarProposeTransferCtrlOwnershipTx,Ft as buildStellarProposeTransferGovOwnTx,ao as buildStellarProposeUnpauseTx,Ct as buildStellarProposeUpdateDelayTx,qt as buildStellarProposeUpgradeControllerTx,Ot as buildStellarProposeUpgradePoolParamsTx,Ut as buildStellarProposeUpgradePoolTx,et as buildStellarRenewAccountTx,M as buildStellarRepayBatchTx,ee as buildStellarRepayDebtWithCollateralTx,H as buildStellarRepayTx,Ve as buildStellarRevokeRoleTx,je as buildStellarRevokeTokenTx,Xe as buildStellarSetAccumulatorTx,Ge as buildStellarSetAggregatorTx,Fe as buildStellarSetLiquidityPoolTemplateTx,Qe as buildStellarSetMarketOracleConfigTx,Ke as buildStellarSetOracleSanityBoundsTx,Ze as buildStellarSetOracleToleranceTx,Me as buildStellarSetPositionLimitsTx,Je as buildStellarSetSpokeAssetFlagsTx,V as buildStellarSupplyBatchTx,D as buildStellarSupplyTx,Y as buildStellarSwapCollateralTx,K as buildStellarSwapDebtTx,De as buildStellarTransferOwnershipTx,We as buildStellarUnpauseTx,nt as buildStellarUpdateAccountThresholdTx,Ye as buildStellarUpdateIndexesTx,Ue as buildStellarUpgradeControllerTx,ot as buildStellarUpgradeLiquidityPoolParamsTx,X as buildStellarWithdrawBatchTx,F as buildStellarWithdrawTx,z as buildTx,xo as decodeStellarLendingEvent,Ae as encodeInterestRateModel,Pe as encodeMarketOracleConfigInput,$e as encodeMarketParamsRaw,Oe as encodeOracleSourceConfigInput,Ee as encodePositionLimits,zo as encodeStrategyPayloadToRouteXdr,Bo as extractEventOrder,ge as getStellarAccountPositions,qo as getStellarAggregatorQuote,h as getStellarAggregatorRouter,pe as getStellarAsset,ve as getStellarAssetGraph,fe as getStellarAssetMarkets,me as getStellarAssetPage,se as getStellarAssets,_ as getStellarGovernance,ye as getStellarGovernanceProposals,he as getStellarHub,Se as getStellarHubGraph,ie as getStellarHubs,ae as getStellarLendingContext,f as getStellarLendingController,ne as getStellarLendingLiveState,Lo as getStellarQuoteTokens,ce as getStellarReserve,Re as getStellarReserveGraph,de as getStellarReserveHolders,le as getStellarReserves,_e as getStellarSpoke,ke as getStellarSpokeGraph,ue as getStellarSpokes,we as getStellarUserActivity,be as getStellarUserPositions,Xo as mapQuoteResponseToAggregatorSwap,Co as mapQuoteResponseToStrategyPayload,Go as mapQuoteResponseToStrategySwap,er as mapSorobanError,Oo as mapStellarPositionActivityType,jo as prepareStellarBuiltTx,Ho as prepareStellarTxXdr,io as stellarLendingDispatchKey,Ie as stellarLendingRead,No as syntheticEventOrder,Mo as tagStellarInvokedContractError,no as toBase64Xdr,Qo as toStellarPositionMode};
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* delegated to `XOXNOClient.fetchWithTimeout`, the same wrapper the generated
|
|
12
12
|
* SDK uses.
|
|
13
13
|
*/
|
|
14
|
-
import type { StellarAssetListItem, StellarAssetPage, StellarHubListItem, StellarReserveListItem, StellarSpokeListItem, StellarUserActivityItem } from '@xoxno/types/stellar-lending';
|
|
14
|
+
import type { StellarAssetListItem, StellarAssetPage, StellarHubListItem, StellarLendingLiveStateDto, StellarReserveListItem, StellarSpokeListItem, StellarUserActivityItem } from '@xoxno/types/stellar-lending';
|
|
15
15
|
import type { OurRequestInit, XOXNOClient } from '../../utils/api';
|
|
16
16
|
import type { StellarAccountPositions, StellarAsset, StellarAssetMarket, StellarGovernanceProposalsPage, StellarHub, StellarLendingHoldersSide, StellarLendingContext, StellarLendingMarketSide, StellarMarketGraph, StellarMarketGraphQuery, StellarReserve, StellarSpoke, StellarTopHolders } from './lending-read-types';
|
|
17
17
|
type StellarReservesParams = {
|
|
@@ -21,6 +21,8 @@ type StellarReservesParams = {
|
|
|
21
21
|
};
|
|
22
22
|
/** Aggregate context for Stellar lending landing/read surfaces. */
|
|
23
23
|
export declare const getStellarLendingContext: (client: XOXNOClient, init?: OurRequestInit) => Promise<StellarLendingContext>;
|
|
24
|
+
/** Live per-hub indexes and controller borrow-collateral floor. */
|
|
25
|
+
export declare const getStellarLendingLiveState: (client: XOXNOClient, init?: OurRequestInit) => Promise<StellarLendingLiveStateDto>;
|
|
24
26
|
/** Every asset, aggregated across hubs — rows for the Deposit/Borrow tables. */
|
|
25
27
|
export declare const getStellarAssets: (client: XOXNOClient, init?: OurRequestInit) => Promise<StellarAssetListItem[]>;
|
|
26
28
|
/** Every hub, aggregated over its hub-assets — rows for the All Hubs table. */
|
|
@@ -82,6 +84,7 @@ export declare const getStellarReserveGraph: (client: XOXNOClient, spokeId: numb
|
|
|
82
84
|
*/
|
|
83
85
|
export declare const stellarLendingRead: (client: XOXNOClient) => {
|
|
84
86
|
context: (init?: OurRequestInit) => Promise<StellarLendingContext>;
|
|
87
|
+
liveState: (init?: OurRequestInit) => Promise<StellarLendingLiveStateDto>;
|
|
85
88
|
assets: (init?: OurRequestInit) => Promise<StellarAssetListItem[]>;
|
|
86
89
|
hubs: (init?: OurRequestInit) => Promise<StellarHubListItem[]>;
|
|
87
90
|
spokes: (init?: OurRequestInit) => Promise<StellarSpokeListItem[]>;
|
package/dist/sdk/swagger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PublicOnly, RateType, LoginAccessDto, LoginRequestDto, UserNetworkInfoDto, UserTokenInventoryResponseDto, UserProfileDoc, UserProfileEditDto, UserProfileDto, UserSettingsDoc, NotificationPreferencesPostDto, SetEmailDto, SetPhoneDto, UserBillingDetails, VerifyEmailDto, TradesilvaniaSignature, SuccessDto, CreatorProfileDto, CreatorProfileDoc, CreatorProfileEditDto, CollectionStatsFilter, CollectionStatsPaginated, CheckLikeStatusResponseDto, UserFavoriteResponseDto, TokenDataDocHydrated, XoxnoInfo, XoxnoLiquidStatsDto, AnalyticsMarketplaceUniqueUsers, ProtocolAprType, ProviderDto, DelegationDataOutput, LendingMarketProfile, LendingMarketProfileFilter, LendingMarketProfileQuery, LendingGovernanceProposalFilter, LendingGovernanceProposalQuery, LendingGovernanceProposalDoc, LendingAccountProfile, LendingIndexesDto, LendingAccountPnl, LendingAccountSummary, LendingEModeCategoryProfile, LendingMarketAnalyticsGraph, LendingStatsHistory, LendingMarketAverageGraph, LendingPositionStatus, LendingOverallStats, NftDocFilter, NftPaginated, LikeNftDto, InventorySummaryDtoHydrated, NftOfferPaginated, NftOfferDocFilter, NftOfferDocHydrated, ValueFp, TraitInfo, CollectionRanksDTO, ListingsResponseDto, NftDocHydrated, SignDataDto, SignWithdrawDto, SignAcceptGlobalOfferDto, SignMintDto, NftDocFull, CollectionProfileDoc, CollectionProfileEditDto, FloorPriceDto, PinnedCollectionDto, CollectionMintProfileDocHydrated, CollectionPinnedStatusDto, FollowCollectionDto, CollectionProfileFilter, CollectionProfilePaginated, CollectionMintProfileFilter, CollectionMintProfilePaginated, CollectionMintProfileDocWithStages, CollectionHoldersDto, CollectionHoldersExportDto, CollectionOwnerDto, CollectionStatsDocHydrated, CollectionOffersFilter, GlobalOfferPaginated, CreatorDetailsDto, ShareholderDto, StakingSummary, StakingPoolDoc, StakingEditDto, OwnedCollectionsDto, UserStakingSummaryDto, StakingCreatorDoc, StakingUserPoolNfts, StakingExploreDtoHydrated, OwnedServicesDto, FilterQueryDto, GlobalSearchResourcesPaginated, LendingNftAttributes, LendingTokenPriceDto, StellarAssetListItemDto, StellarLendingContextDto, StellarHubListItemDto, StellarSpokeListItemDto, StellarReserveListItemDto, ReserveDto, TopHoldersDto, AssetDto, AssetPageDto, AssetMarketDto, HubDto, SpokeDto, AccountPositionsDto, StellarUserActivityItemDto, GovernanceProposalsPageDto, MarketGraphDto, SpokeGraphDto, StellarStatsHistoryDto, StellarPositionsPnlDto, StellarPositionsRankDto, UserHistoryDto, PnlByScopeDto, RevenueSeriesDto, FeeRevenueSeriesDto, ParticipantCountsDto, LiquidationsSeriesDto, LiquidationsLeaderboardDto, VolumeSeriesDto, ActiveUsersSeriesDto, HolderDistributionDto, RateSpreadSeriesDto, DefiLlamaDimensionsDto, NotificationPaginated, PushNotificationCountResponse, NotificationDoc, MobileDeviceDoc, MobileDeviceRegistrationDto, PushNotificationResponse, PushNotificationDoc, NotificationSuccessResponseDto, EventNotificationDto, CreatorMarketingNotificationDto, StellarChallengeResponseDto, Web2UserDoc, SuccessWithMessageDto, NativeWalletDto, SwitchWalletDto, Web2WalletDto, Web2UserShardsDto, NftActivityFilter, NftActivityPaginated, NftActivityDocHydrated, VolumeGraph, AnalyticsVolumeDto, UserAnalyticsDto, GlobalAnalyticsOverviewResponseDto, UserStatsDto, AirdropDtoHydrated, TransactionDetailed, TransactionProcessStatus, TransactionCostData, TransactionCreate, TransactionSendResult, ChatMessageDocHydrated, SendChatMessageDto, UserConversationPaginated, ChatMessagePaginated, GlobalConversationSummaryDto, UserBlockPaginated, WebSocketTokenDto, UserInfo, EventProfile, EventProfileCreateDto, EventProfileEditDto, EventProfileFilter, EventProfileQuery, EventRegistrationResponseDto, EventGuestRegistrationDto, EventTicketProfileDoc, EventTicketProfileCreateDto, EventTicketProfileEditDto, EventStageProfileDoc, EventStageProfileCreateDto, EventStageProfileEditDto, TicketPricesResponse, TicketCalculationRequestDto, DiscountCodeValidationResponse, EventInvitationDoc, EventInvitationCreateDto, EventInvitationFilter, EventInvitationQuery, EventInvitation, EventAcceptInvitation, EventClaimInvitationDto, EventVoucherFilter, EventVoucherQuery, EventQuestionDoc, EventQuestionCreateDto, EventQuestionEditDto, EventGuestFilter, EventGuestProfileQuery, EventGuestProfile, EventGuestExport, EventUserRole, EventUserRoleCreateDto, EventUserRoleEditDto, EventUserRoleDoc, BageQRData, TicketValidationResult, EventCheckInQR, EventVoucherDoc, EventVoucherCreateDto, EventVoucherEditDto, ManualCheckInDto, AnsweredQuestionWithDetails, EventGuestApproveDto, EventCountGroupedByCountry, EventReferralConfigDoc, EventReferralConfigCreateDto, EventReferralConfigEditDto, EventReferralConfigFilter, EventReferralConfigPaginated, EventReferralDoc, EventReferralCreateDto, EventReferralEditDto, EventReferralFilter, EventReferralPaginated, BlendUserPosition, SoroswapQuoteResponseDto, PerpOrderResponse, BarDto, SymbolInfoDto, PerpCoinExtended, PerpSpotCoinExtended, PerpCoinExtendedSlim, PerpLegalCheck, PerpSpotCoinExtendedSlim, L2BookPerpResponseSingle, TradesPerpResponseSingle, ActiveSpotAssetCtx, ActivePerpAssetCtx, PerpEvent } from '@xoxno/types';
|
|
1
|
+
import type { PublicOnly, RateType, LoginAccessDto, LoginRequestDto, UserNetworkInfoDto, UserTokenInventoryResponseDto, UserProfileDoc, UserProfileEditDto, UserProfileDto, UserSettingsDoc, NotificationPreferencesPostDto, SetEmailDto, SetPhoneDto, UserBillingDetails, VerifyEmailDto, TradesilvaniaSignature, SuccessDto, CreatorProfileDto, CreatorProfileDoc, CreatorProfileEditDto, CollectionStatsFilter, CollectionStatsPaginated, CheckLikeStatusResponseDto, UserFavoriteResponseDto, TokenDataDocHydrated, XoxnoInfo, XoxnoLiquidStatsDto, AnalyticsMarketplaceUniqueUsers, ProtocolAprType, ProviderDto, DelegationDataOutput, LendingMarketProfile, LendingMarketProfileFilter, LendingMarketProfileQuery, LendingGovernanceProposalFilter, LendingGovernanceProposalQuery, LendingGovernanceProposalDoc, LendingAccountProfile, LendingIndexesDto, LendingAccountPnl, LendingAccountSummary, LendingEModeCategoryProfile, LendingMarketAnalyticsGraph, LendingStatsHistory, LendingMarketAverageGraph, LendingPositionStatus, LendingOverallStats, NftDocFilter, NftPaginated, LikeNftDto, InventorySummaryDtoHydrated, NftOfferPaginated, NftOfferDocFilter, NftOfferDocHydrated, ValueFp, TraitInfo, CollectionRanksDTO, ListingsResponseDto, NftDocHydrated, SignDataDto, SignWithdrawDto, SignAcceptGlobalOfferDto, SignMintDto, NftDocFull, CollectionProfileDoc, CollectionProfileEditDto, FloorPriceDto, PinnedCollectionDto, CollectionMintProfileDocHydrated, CollectionPinnedStatusDto, FollowCollectionDto, CollectionProfileFilter, CollectionProfilePaginated, CollectionMintProfileFilter, CollectionMintProfilePaginated, CollectionMintProfileDocWithStages, CollectionHoldersDto, CollectionHoldersExportDto, CollectionOwnerDto, CollectionStatsDocHydrated, CollectionOffersFilter, GlobalOfferPaginated, CreatorDetailsDto, ShareholderDto, StakingSummary, StakingPoolDoc, StakingEditDto, OwnedCollectionsDto, UserStakingSummaryDto, StakingCreatorDoc, StakingUserPoolNfts, StakingExploreDtoHydrated, OwnedServicesDto, FilterQueryDto, GlobalSearchResourcesPaginated, LendingNftAttributes, LendingTokenPriceDto, StellarAssetListItemDto, StellarLendingContextDto, StellarLendingLiveStateDto, StellarHubListItemDto, StellarSpokeListItemDto, StellarReserveListItemDto, ReserveDto, TopHoldersDto, AssetDto, AssetPageDto, AssetMarketDto, HubDto, SpokeDto, AccountPositionsDto, StellarUserActivityItemDto, GovernanceProposalsPageDto, MarketGraphDto, SpokeGraphDto, StellarStatsHistoryDto, StellarPositionsPnlDto, StellarPositionsRankDto, UserHistoryDto, PnlByScopeDto, RevenueSeriesDto, FeeRevenueSeriesDto, ParticipantCountsDto, LiquidationsSeriesDto, LiquidationsLeaderboardDto, VolumeSeriesDto, ActiveUsersSeriesDto, HolderDistributionDto, RateSpreadSeriesDto, DefiLlamaDimensionsDto, NotificationPaginated, PushNotificationCountResponse, NotificationDoc, MobileDeviceDoc, MobileDeviceRegistrationDto, PushNotificationResponse, PushNotificationDoc, NotificationSuccessResponseDto, EventNotificationDto, CreatorMarketingNotificationDto, StellarChallengeResponseDto, Web2UserDoc, SuccessWithMessageDto, NativeWalletDto, SwitchWalletDto, Web2WalletDto, Web2UserShardsDto, NftActivityFilter, NftActivityPaginated, NftActivityDocHydrated, VolumeGraph, AnalyticsVolumeDto, UserAnalyticsDto, GlobalAnalyticsOverviewResponseDto, UserStatsDto, AirdropDtoHydrated, TransactionDetailed, TransactionProcessStatus, TransactionCostData, TransactionCreate, TransactionSendResult, ChatMessageDocHydrated, SendChatMessageDto, UserConversationPaginated, ChatMessagePaginated, GlobalConversationSummaryDto, UserBlockPaginated, WebSocketTokenDto, UserInfo, EventProfile, EventProfileCreateDto, EventProfileEditDto, EventProfileFilter, EventProfileQuery, EventRegistrationResponseDto, EventGuestRegistrationDto, EventTicketProfileDoc, EventTicketProfileCreateDto, EventTicketProfileEditDto, EventStageProfileDoc, EventStageProfileCreateDto, EventStageProfileEditDto, TicketPricesResponse, TicketCalculationRequestDto, DiscountCodeValidationResponse, EventInvitationDoc, EventInvitationCreateDto, EventInvitationFilter, EventInvitationQuery, EventInvitation, EventAcceptInvitation, EventClaimInvitationDto, EventVoucherFilter, EventVoucherQuery, EventQuestionDoc, EventQuestionCreateDto, EventQuestionEditDto, EventGuestFilter, EventGuestProfileQuery, EventGuestProfile, EventGuestExport, EventUserRole, EventUserRoleCreateDto, EventUserRoleEditDto, EventUserRoleDoc, BageQRData, TicketValidationResult, EventCheckInQR, EventVoucherDoc, EventVoucherCreateDto, EventVoucherEditDto, ManualCheckInDto, AnsweredQuestionWithDetails, EventGuestApproveDto, EventCountGroupedByCountry, EventReferralConfigDoc, EventReferralConfigCreateDto, EventReferralConfigEditDto, EventReferralConfigFilter, EventReferralConfigPaginated, EventReferralDoc, EventReferralCreateDto, EventReferralEditDto, EventReferralFilter, EventReferralPaginated, BlendUserPosition, SoroswapQuoteResponseDto, PerpOrderResponse, BarDto, SymbolInfoDto, PerpCoinExtended, PerpSpotCoinExtended, PerpCoinExtendedSlim, PerpLegalCheck, PerpSpotCoinExtendedSlim, L2BookPerpResponseSingle, TradesPerpResponseSingle, ActiveSpotAssetCtx, ActivePerpAssetCtx, PerpEvent } from '@xoxno/types';
|
|
2
2
|
import type { ActivityChain, TokenCategory, LendingPositionOrderByColumn, KustoOrderDirection, OfferType, StakingStatus, UserStatsOrderByColumn } from '@xoxno/types/enums';
|
|
3
3
|
export declare const endpoints: {
|
|
4
4
|
readonly "/liquid/xoxno/rate": {
|
|
@@ -912,6 +912,10 @@ export declare const endpoints: {
|
|
|
912
912
|
readonly input: {};
|
|
913
913
|
readonly output: StellarLendingContextDto;
|
|
914
914
|
};
|
|
915
|
+
readonly "/stellar-lending/live-state": {
|
|
916
|
+
readonly input: {};
|
|
917
|
+
readonly output: StellarLendingLiveStateDto;
|
|
918
|
+
};
|
|
915
919
|
readonly "/stellar-lending/hubs": {
|
|
916
920
|
readonly input: {};
|
|
917
921
|
readonly output: StellarHubListItemDto[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.191",
|
|
4
4
|
"description": "The SDK to interact with the XOXNO Protocol!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"dependencies": {
|
|
115
115
|
"@multiversx/sdk-core": "^15.3.2",
|
|
116
116
|
"@multiversx/sdk-network-providers": "^2.9.3",
|
|
117
|
-
"@xoxno/types": "^1.0.
|
|
117
|
+
"@xoxno/types": "^1.0.467"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
120
|
"@stellar/stellar-sdk": ">=15.0.0 <17.0.0"
|