@xoxno/sdk-js 1.0.164 → 1.0.170
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 +108 -0
- package/dist/cjs/sdk/stellar/lending-read-types.d.ts +2 -1
- package/dist/cjs/sdk/stellar/lending-read.d.ts +5 -1
- package/dist/cjs/sdk/stellar/lending.d.ts +1 -0
- package/dist/cjs/sdk/swagger.d.ts +250 -1
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/sdk/stellar/lending-read-types.d.ts +2 -1
- package/dist/sdk/stellar/lending-read.d.ts +5 -1
- package/dist/sdk/stellar/lending.d.ts +1 -0
- package/dist/sdk/swagger.d.ts +250 -1
- package/package.json +2 -2
|
@@ -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 l={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},c={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},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"},_={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function f(e){const t=l[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 m(e){const t=c[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 h(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const y=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],w=e=>new t(e).toScVal(),b=e=>new a(e).toI128(),g=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),T=()=>i.ScVal.scvVoid(),x=e=>i.ScVal.scvVec(e),E=(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)},I=(e,t)=>null==e?T():t(e),B=(e,t)=>O({asset:w(t),hub_id:g(e)}),$=(e,t,o)=>i.ScVal.scvVec([B(e,t),b(o)]),A=e=>i.ScVal.scvVec(e.map((e=>$(e.hubId,e.asset,e.amount)))),O=e=>{const t=Object.keys(e).sort().map((t=>new i.ScMapEntry({key:R(t),val:e[t]})));return i.ScVal.scvMap(t)},N=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return O({amount_out:b(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 O({hops:i.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return O({paths:i.ScVal.scvVec(t),referral_id:v(e.referralId??0),token_in:w(e.tokenIn),token_out:w(e.tokenOut),total_min_out:b(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)},C=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},U=e=>{if("string"==typeof e)return P(C(e));if(e instanceof Uint8Array)return P(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?P(C(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(C(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(C(e.bytes)):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||!y.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return t})(e),i.ScVal.scvBytes(Buffer.from(N(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},q=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 L(t,a,s){const i=t.controllerAddress??f(t.network),l=new r(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??o,networkPassphrase:_[t.network]}).addOperation(l.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function V(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"supply",[w(e.caller),v(o),g(r),A([...t.assets])])}function z(e,t){return V(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function D(e,t){return L(e,"borrow",[w(e.caller),v(t.accountNonce),A([...t.borrows]),I(t.to,w)])}function W(e,t){return D(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return L(e,"withdraw",[w(e.caller),v(t.accountNonce),A([...t.withdrawals]),I(t.to,w)])}function M(e,t){return G(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function X(e,t){return L(e,"repay",[w(e.caller),v(t.accountNonce),A([...t.payments])])}function F(e,t){return X(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return L(e,"liquidate",[w(e.caller),v(t.accountNonce),A([...t.debtPayments])])}function j(e,t){return L(e,"flash_loan",[w(e.caller),B(t.hubId,t.asset),b(t.amount),w(t.receiver),q(t.data)])}function Q(e,t){return L(e,"migrate_from_blend",[w(e.caller),v(t.accountId),g(t.spokeId),w(t.blendPool),x(t.collateralTokens.map(w)),x(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),b(o)]);var t,o}))))]);var o}function Z(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"multiply",[w(e.caller),v(o),g(r),B(t.collateral.hubId,t.collateral.asset),b(t.debtToFlashLoan),B(t.debt.hubId,t.debt.asset),g(t.mode),U(t.steps),I(t.initialPayment,(e=>$(e.hubId,e.asset,e.amount))),I(t.convertSwap,U)])}function J(e,t){return L(e,"swap_debt",[w(e.caller),v(t.accountNonce),B(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),B(t.newDebt.hubId,t.newDebt.asset),U(t.steps)])}function K(e,t){return L(e,"swap_collateral",[w(e.caller),v(t.accountNonce),B(t.current.hubId,t.current.asset),b(t.fromAmount),B(t.newCollateral.hubId,t.newCollateral.asset),U(t.steps)])}function Y(e,t){return L(e,"repay_debt_with_collateral",[w(e.caller),v(t.accountNonce),B(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),B(t.debt.hubId,t.debt.asset),U(t.steps),S(t.closePosition)])}const ee="/stellar-lending",te=25,oe=encodeURIComponent,re=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),se=(e,t={},o)=>{const{hubId:r,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${ee}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ie=(e,t,o,r,a)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${o}/${oe(r)}`,a),le=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${o}/${oe(r)}/holders`,{...n,params:{side:a}}),ce=(e,t,o)=>e.fetchWithTimeout(`${ee}/assets/${oe(t)}`,o),ue=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/assets/${oe(t)}/markets`,{...r,params:{side:o}}),pe=(e,t,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,o),de=(e,t,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,o),_e=(e,t,o)=>e.fetchWithTimeout(`${ee}/users/${oe(t)}/positions`,o),fe=(e,t,o={},r)=>{const{skip:a,top:n}=o;return e.fetchWithTimeout(`${ee}/users/${oe(t)}/activity`,{...r,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},me=(e,t,o)=>e.fetchWithTimeout(`${ee}/accounts/${oe(t)}/positions`,o),he=(e,t={},o)=>{const{top:r=te,continuationToken:a}=t;return e.fetchWithTimeout(`${ee}/governance/proposals`,{...o,params:{top:r,...a?{continuationToken:a}:{}}})},ye=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/assets/${oe(t)}/graph`,{...r,params:{...o}}),we=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...r,params:{...o}}),be=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...r,params:{...o}}),ge=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${o}/${oe(r)}/graph`,{...n,params:{...a}}),ve=e=>({assets:t=>re(e,t),hubs:t=>ae(e,t),spokes:t=>ne(e,t),reserves:(t,o)=>se(e,t,o),reserve:(t,o,r,a)=>ie(e,t,o,r,a),reserveHolders:(t,o,r,a,n)=>le(e,t,o,r,a,n),asset:(t,o)=>ce(e,t,o),assetMarkets:(t,o,r)=>ue(e,t,o,r),hub:(t,o)=>pe(e,t,o),spoke:(t,o)=>de(e,t,o),userPositions:(t,o)=>_e(e,t,o),userActivity:(t,o,r)=>fe(e,t,o,r),accountPositions:(t,o)=>me(e,t,o),governanceProposals:(t,o)=>he(e,t,o),assetGraph:(t,o,r)=>ye(e,t,o,r),hubGraph:(t,o,r)=>we(e,t,o,r),spokeGraph:(t,o,r)=>be(e,t,o,r),reserveGraph:(t,o,r,a,n)=>ge(e,t,o,r,a,n)}),Se={Single:0,PrimaryWithAnchor:1},ke=e=>O({base_borrow_rate_ray:b(e.baseBorrowRateRay),max_borrow_rate_ray:b(e.maxBorrowRateRay),max_utilization_ray:b(e.maxUtilizationRay),mid_utilization_ray:b(e.midUtilizationRay),optimal_utilization_ray:b(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:b(e.slope1Ray),slope2_ray:b(e.slope2Ray),slope3_ray:b(e.slope3Ray)}),Re=e=>O({asset_decimals:g(e.assetDecimals),asset_id:w(e.assetId),base_borrow_rate_ray:b(e.baseBorrowRateRay),borrow_cap:b(e.borrowCap),max_borrow_rate_ray:b(e.maxBorrowRateRay),max_utilization_ray:b(e.maxUtilizationRay),mid_utilization_ray:b(e.midUtilizationRay),optimal_utilization_ray:b(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:b(e.slope1Ray),slope2_ray:b(e.slope2Ray),slope3_ray:b(e.slope3Ray),supply_cap:b(e.supplyCap)}),Te=e=>O({asset_decimals:g(0),e_mode_categories:x(e.eModeCategories.map((e=>g(e)))),flashloan_fee_bps:g(e.flashloanFeeBps),is_borrowable:S(e.isBorrowable),is_collateralizable:S(e.isCollateralizable),is_flashloanable:S(e.isFlashloanable),liquidation_bonus_bps:g(e.liquidationBonusBps),liquidation_fees_bps:g(e.liquidationFeesBps),liquidation_threshold_bps:g(e.liquidationThresholdBps),loan_to_value_bps:g(e.loanToValueBps)}),xe=e=>O({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Ee=e=>{const t=e.kind;switch(t){case"Stellar":return x([R("Stellar"),w(e.value)]);case"Symbol":return x([R("Symbol"),R(e.value)]);case"String":return x([R("String"),k(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 x([R("Twap"),g(t)])}return x([R("Spot")])},Be=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return x([R("Reflector"),O({asset:Ee(e.asset),contract:w(e.contract),read_mode:Ie(e.readMode,e.twapRecords)})])}if("RedStonePriceFeed"===t){if("string"!=typeof e.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof e.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return x([R("RedStone"),O({contract:w(e.contract),feed_id:k(e.feedId),max_stale_seconds:v(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},$e=e=>{const t=Se[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return O({anchor:(o=e.anchor,x(null==o?[R("None")]:[R("Some"),Be(o)])),max_price_stale_seconds:v(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:Be(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Ae(e,t){return L(e,"upgrade",[E(t.wasmHash)])}function Oe(e,t){return L(e,"migrate",[g(t.newVersion)])}function Ne(e){return L(e,"pause",[])}function Pe(e){return L(e,"unpause",[])}function Ce(e,t){return L(e,"grant_role",[w(t.account),R(t.role)])}function Ue(e,t){return L(e,"revoke_role",[w(t.account),R(t.role)])}function qe(e,t){return L(e,"transfer_ownership",[w(t.newOwner),g(t.liveUntilLedger)])}function Le(e){return L(e,"accept_ownership",[])}function Ve(e,t){return L(e,"set_aggregator",[w(t.aggregator)])}function ze(e,t){return L(e,"set_accumulator",[w(t.accumulator)])}function De(e,t){return L(e,"set_liquidity_pool_template",[E(t.wasmHash)])}function We(e,t){return L(e,"edit_asset_config",[w(t.asset),Te(t.config)])}function Ge(e,t){return L(e,"set_position_limits",[xe(t)])}function Me(e){return L(e,"add_e_mode_category",[])}function Xe(e,t){return L(e,"remove_e_mode_category",[g(t.id)])}const Fe=e=>O({asset:w(e.asset),category_id:g(e.categoryId),can_collateral:S(e.canCollateral),can_borrow:S(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:b(e.supplyCap),borrow_cap:b(e.borrowCap)});function He(e,t){return L(e,"add_asset_to_e_mode_category",[Fe(t)])}function je(e,t){return L(e,"edit_asset_in_e_mode_category",[Fe(t)])}function Qe(e,t){return L(e,"update_pool_caps",[w(t.asset),b(t.supplyCap),b(t.borrowCap)])}function Ze(e,t){return L(e,"remove_asset_from_e_mode",[w(t.asset),g(t.categoryId)])}function Je(e,t){return L(e,"approve_token",[w(t.token)])}function Ke(e,t){return L(e,"revoke_token",[w(t.token)])}function Ye(e,t){return L(e,"configure_market_oracle",[w(e.caller),w(t.asset),$e(t.config)])}function et(e,t){return L(e,"edit_oracle_tolerance",[w(e.caller),w(t.asset),g(t.tolerance)])}function tt(e,t){return L(e,"disable_token_oracle",[w(e.caller),w(t.asset)])}function ot(e,t){return L(e,"update_indexes",[w(e.caller),x(t.assets.map((e=>w(e))))])}function rt(e,t){return L(e,"renew_account",[w(e.caller),v(t.accountNonce)])}function at(e,t){return L(e,"create_liquidity_pool",[w(t.asset),Re(t.params),Te(t.config)])}function nt(e,t){return L(e,"upgrade_liquidity_pool_params",[w(t.asset),ke(t.params)])}function st(e,t){return L(e,"upgrade_liquidity_pool",[w(t.asset),E(t.wasmHash)])}function it(e,t){return L(e,"claim_revenue",[w(e.caller),x(t.assets.map((e=>w(e))))])}function lt(e,t){return L(e,"add_rewards",[w(e.caller),x(t.rewards.map((e=>x([w(e.token),b(e.amount)]))))])}function ct(e,t){return L(e,"update_account_threshold",[w(e.caller),w(t.asset),S(t.hasRisks),x(t.accountNonces.map((e=>v(e))))])}const ut="00".repeat(32),pt=e=>{if("string"==typeof e)return E(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)},dt=(e,...t)=>x([R(e),...t]),_t=e=>O({asset:w(e.asset),category_id:g(e.categoryId),can_collateral:S(e.canCollateral),can_borrow:S(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:b(e.supplyCap),borrow_cap:b(e.borrowCap)}),ft=e=>O({new_owner:w(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),mt=e=>O({account:w(e.account),role:R(e.role)});function ht(t,a,s){const i=t.governanceAddress??h(t.network),l=new r(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??o,networkPassphrase:_[t.network]}).addOperation(l.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const yt=(e,t,o)=>ht(e,"propose",[w(e.caller),t,pt(o)]),wt=(e,t,o)=>ht(e,"execute_self",[T(),t,pt(o)]);function bt(e,t,o){return yt(e,dt("SetAggregator",w(t.aggregator)),o)}function gt(e,t,o){return yt(e,dt("SetAccumulator",w(t.accumulator)),o)}function vt(e,t,o){return yt(e,dt("SetLiquidityPoolTemplate",E(t.wasmHash)),o)}function St(e,t,o){return yt(e,dt("EditAssetConfig",w(t.asset),Te(t.config)),o)}function kt(e,t,o){return yt(e,dt("SetPositionLimits",xe(t)),o)}function Rt(e,t,o){return yt(e,dt("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function Tt(e,t){return yt(e,dt("AddEModeCategory"),t)}function xt(e,t,o){return yt(e,dt("RemoveEModeCategory",g(t.id)),o)}function Et(e,t,o){return yt(e,dt("AddAssetToEModeCategory",_t(t)),o)}function It(e,t,o){return yt(e,dt("EditAssetInEModeCategory",_t(t)),o)}function Bt(e,t,o){return yt(e,dt("UpdatePoolCaps",O({asset:w((r=t).asset),supply_cap:b(r.supplyCap),borrow_cap:b(r.borrowCap)})),o);var r}function $t(e,t,o){return yt(e,dt("RemoveAssetFromEMode",O({asset:w((r=t).asset),category_id:g(r.categoryId)})),o);var r}function At(e,t,o){return yt(e,dt("ApproveToken",w(t.token)),o)}function Ot(e,t,o){return yt(e,dt("RevokeToken",w(t.token)),o)}function Nt(e,t,o){return yt(e,dt("ApproveBlendPool",w(t.pool)),o)}function Pt(e,t,o){return yt(e,dt("RevokeBlendPool",w(t.pool)),o)}function Ct(e,t,o){return yt(e,dt("CreateLiquidityPool",O({asset:w((r=t).asset),params:Re(r.params),config:Te(r.config)})),o);var r}function Ut(e,t,o){return yt(e,dt("UpgradeLiquidityPoolParams",O({asset:w((r=t).asset),params:ke(r.params)})),o);var r}function qt(e,t){return yt(e,dt("DeployPool"),t)}function Lt(e,t,o){return yt(e,dt("UpgradePool",E(t.wasmHash)),o)}function Vt(e,t,o){return yt(e,dt("DisableTokenOracle",w(t.asset)),o)}function zt(e,t,o){return yt(e,dt("UpgradeController",E(t.wasmHash)),o)}function Dt(e,t,o){return yt(e,dt("MigrateController",g(t.newVersion)),o)}function Wt(e,t,o){return yt(e,dt("TransferCtrlOwnership",ft(t)),o)}function Gt(e,t,o){return yt(e,dt("ConfigureMarketOracle",O({asset:w((r=t).asset),cfg:$e(r.config)})),o);var r}function Mt(e,t,o){return yt(e,dt("EditOracleTolerance",O({asset:w((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Xt(e,t,o){return yt(e,dt("UpgradeGov",E(t.wasmHash)),o)}function Ft(e,t,o){return yt(e,dt("UpdateGovDelay",g(t.newDelay)),o)}function Ht(e,t,o){return yt(e,dt("GrantGovRole",mt(t)),o)}function jt(e,t,o){return yt(e,dt("RevokeGovRole",mt(t)),o)}function Qt(e,t,o){return yt(e,dt("TransferGovOwnership",ft(t)),o)}function Zt(e,t){const o=x(t.argsXdr.map((e=>i.ScVal.fromXDR(e,"base64")))),r=pt(t.predecessor??ut);return ht(e,"execute",[T(),w(t.target),R(t.functionName),o,r,pt(t.salt)])}function Jt(e,t,o){return wt(e,dt("UpgradeGov",E(t.wasmHash)),o)}function Kt(e,t,o){return wt(e,dt("UpdateGovDelay",g(t.newDelay)),o)}function Yt(e,t,o){return wt(e,dt("GrantGovRole",mt(t)),o)}function eo(e,t,o){return wt(e,dt("RevokeGovRole",mt(t)),o)}function to(e,t,o){return wt(e,dt("TransferGovOwnership",ft(t)),o)}const oo=e=>e.toXDR("base64"),ro=e=>i.ScVal.fromXDR(e,"base64"),ao=e=>e.map((e=>String(s(ro(e))))).join(":"),no=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),so=e=>Number(e),io=e=>String(e),lo=e=>null==e?void 0:no(e),co=e=>null==e?void 0:io(e),uo=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),po=["None","Multiply","Long","Short"],_o=["Single","PrimaryWithAnchor"],fo=["ReflectorSep40","RedStonePriceFeed"],mo=["Spot","Twap"],ho=["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:[],wo=e=>({loanToValueBps:so(e.loan_to_value_bps),liquidationThresholdBps:so(e.liquidation_threshold_bps),liquidationBonusBps:so(e.liquidation_bonus_bps),liquidationFeesBps:so(e.liquidation_fees_bps),isCollateralizable:Boolean(e.is_collateralizable),isBorrowable:Boolean(e.is_borrowable),isFlashloanable:Boolean(e.is_flashloanable),flashloanFeeBps:so(e.flashloan_fee_bps),eModeCategories:(e.e_mode_categories??[]).map(so)}),bo=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],ho[so(r)]??no(r)),positionType:t,asset:io(e[1]),scaledAmountRay:no(e[2]),indexRay:no(e[3]),amount:no(e[4]),liquidationThresholdBps:o?void 0:so(e[5]),liquidationBonusBps:o?void 0:so(e[6]),loanToValueBps:o?void 0:so(e[7])};var r},go=e=>{return{owner:io(e[0]),eModeCategoryId:so(e[1]),mode:(t=e[2],po[so(t)]??"None")};var t},vo=(e,t)=>{const o=mo[so(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:io(r)}:null!=a?{kind:"Symbol",value:io(a)}:void 0;return{provider:fo[so(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:io(e[`${t}_contract`]),asset:n,feedId:co(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?so(e[`${t}_twap_records`]):void 0,decimals:so(e[`${t}_decimals`]),resolutionSeconds:so(e[`${t}_resolution_seconds`]),maxStaleSeconds:so(e[`${t}_max_stale_seconds`])}},So=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:io(e.base_token_id),quoteTokenId:io(e.quote_token_id),tolerance:{upperRatio:so(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:so(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:so(e.asset_decimals),maxPriceStaleSeconds:so(e.max_price_stale_seconds),strategy:_o[so(e.strategy)]??"Single",primary:vo(e,"primary"),anchor:t?vo(e,"anchor"):void 0,primaryQuoteToken:co(e.primary_quote_token),anchorQuoteToken:co(e.anchor_quote_token),minSanityPriceWad:lo(e.min_sanity_price_wad),maxSanityPriceWad:lo(e.max_sanity_price_wad)}},ko={"market:create":e=>({topic:"market:create",data:{baseAsset:io(e.base_asset),maxBorrowRate:no(e.max_borrow_rate),baseBorrowRate:no(e.base_borrow_rate),slope1:no(e.slope1),slope2:no(e.slope2),slope3:no(e.slope3),midUtilization:no(e.mid_utilization),optimalUtilization:no(e.optimal_utilization),maxUtilization:lo(e.max_utilization),reserveFactor:so(e.reserve_factor),marketAddress:io(e.market_address),config:wo(e.config)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:io(e.asset),maxBorrowRateRay:no(e.max_borrow_rate_ray),baseBorrowRateRay:no(e.base_borrow_rate_ray),slope1Ray:no(e.slope1_ray),slope2Ray:no(e.slope2_ray),slope3Ray:no(e.slope3_ray),midUtilizationRay:no(e.mid_utilization_ray),optimalUtilizationRay:no(e.optimal_utilization_ray),maxUtilizationRay:lo(e.max_utilization_ray),reserveFactorBps:so(e.reserve_factor_bps)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:yo(e).map((e=>{return t=yo(e),{asset:io(t[0]),timestamp:so(t[1]),supplyIndexRay:no(t[2]),borrowIndexRay:no(t[3]),reservesRay:no(t[4]),suppliedRay:no(t[5]),borrowedRay:no(t[6]),revenueRay:no(t[7]),assetPriceWad:lo(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:yo(e).map((e=>{const t=e;return{asset:io(t.asset),params:(o=t.params,{maxBorrowRateRay:no(o.max_borrow_rate_ray),baseBorrowRateRay:no(o.base_borrow_rate_ray),slope1Ray:no(o.slope1_ray),slope2Ray:no(o.slope2_ray),slope3Ray:no(o.slope3_ray),midUtilizationRay:no(o.mid_utilization_ray),optimalUtilizationRay:no(o.optimal_utilization_ray),maxUtilizationRay:lo(o.max_utilization_ray),reserveFactorBps:so(o.reserve_factor_bps),supplyCap:no(o.supply_cap),borrowCap:no(o.borrow_cap),assetId:co(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:so(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=yo(e);return{topic:"position:batch_update",data:{accountId:no(t[0]),accountAttributes:go(yo(t[1])),updates:[...yo(t[2]).map((e=>bo(yo(e),"Deposit"))),...yo(t[3]).map((e=>bo(yo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{asset:io(e.asset),receiver:io(e.receiver),caller:io(e.caller),amount:no(e.amount),fee:no(e.fee)}}),"config:asset":e=>({topic:"config:asset",data:{asset:io(e.asset),config:wo(e.config)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:io(e.asset),oracle:So(e.oracle)}}),"config:emode_category":e=>({topic:"config:emode_category",data:{category:{categoryId:so(e.category.category_id),isDeprecated:Boolean(e.category.is_deprecated)}}}),"config:emode_asset":e=>({topic:"config:emode_asset",data:{asset:io(e.asset),config:{isCollateralizable:Boolean(e.config.is_collateralizable),isBorrowable:Boolean(e.config.is_borrowable),loanToValueBps:so(e.config.loan_to_value_bps),liquidationThresholdBps:so(e.config.liquidation_threshold_bps),liquidationBonusBps:so(e.config.liquidation_bonus_bps),supplyCap:no(e.config.supply_cap),borrowCap:no(e.config.borrow_cap)},categoryId:so(e.category_id)}}),"config:remove_emode_asset":e=>({topic:"config:remove_emode_asset",data:{asset:io(e.asset),categoryId:so(e.category_id)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:no(e.account_id),totalBorrowUsdWad:no(e.total_borrow_usd_wad),totalCollateralUsdWad:no(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:io(e.token),amount:no(e.amount),usdValueWad:no(e.usd_value_wad),accountId:no(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{asset:io(e.asset),amount:no(e.amount),fee:no(e.fee),amountSent:no(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:uo(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:io(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:io(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:uo(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:so(e.max_supply_positions),maxBorrowPositions:so(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:io(e.asset)}})},Ro=Object.freeze(Object.keys(ko));function To(e,t){const o=ao(e),r=ko[o];return r?r(s(ro(t))):null}const xo="XLENDXLM-a7c9f3",Eo=1e4;function Io(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${xo}-${o}`}function Bo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function $o(e,t=0){return 1e4*e+t}function Ao(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()},No=e=>e.baseUrl??d[e.network];async function Po(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(No(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 Co(e){const t=Oo(No(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 Uo=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,qo=e=>N(e).toXDR("base64");function Lo(t,a){const s=t.routerAddress??m(t.network),i=new r(s),l=new e(t.caller,t.sourceSequence),c=U(Uo(a,t.referralId));return{xdr:new n(l,{fee:t.fee??o,networkPassphrase:_[t.network]}).addOperation(i.call("execute_strategy",w(t.caller),b(t.totalIn),c)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function Vo(e,t){return Lo(e,t)}function zo(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(Go),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Go),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Do(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:zo(e,t)}const Wo=zo,Go=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 Xo(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 Fo(e,t,o){return Xo(e,t.xdr,o)}function Ho(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 jo(e,t){return{paths:[{hops:[{amountOut:"0",pool:e,tokenIn:e,tokenOut:e,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:e,tokenOut:e,totalMinOut:t}}const Qo=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 Zo(t){const o=new e(t.caller,t.sourceSequence),a=new r(t.forwarderAddress).call("mint_and_forward",i.ScVal.scvBytes(Qo(t.message)),i.ScVal.scvBytes(Qo(t.attestation)));return{xdr:new n(o,{fee:t.fee??"10000000",networkPassphrase:_[t.network]}).addOperation(a).setTimeout(t.timeoutSeconds??120).build().toXDR()}}export{c as STELLAR_AGGREGATOR_ROUTER,u as STELLAR_GOVERNANCE,ut as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,l as STELLAR_LENDING_CONTROLLER,Ro as STELLAR_LENDING_TOPICS,_ as STELLAR_NETWORK_PASSPHRASE,d as STELLAR_QUOTE_URL,p as STELLAR_SOROBAN_RPC_URL,Eo as SYNTHETIC_EVENT_ORDER_STRIDE,xo as XOXNO_LENDING_STELLAR_TICKER,jo as buildSameTokenRepaySwapSteps,Le as buildStellarAcceptOwnershipTx,He as buildStellarAddAssetToEModeCategoryTx,Me as buildStellarAddEModeCategoryTx,lt as buildStellarAddRewardsTx,Je as buildStellarApproveTokenTx,Vo as buildStellarBatchSwapTx,D as buildStellarBorrowBatchTx,W as buildStellarBorrowTx,Zo as buildStellarCctpForwardTx,it as buildStellarClaimRevenueTx,Ye as buildStellarConfigureMarketOracleTx,at as buildStellarCreateLiquidityPoolTx,tt as buildStellarDisableTokenOracleTx,We as buildStellarEditAssetConfigTx,je as buildStellarEditAssetInEModeCategoryTx,et as buildStellarEditOracleToleranceTx,Lo as buildStellarExecuteStrategyTx,j as buildStellarFlashLoanTx,Jt as buildStellarGovernanceExecuteGovernanceUpgradeTx,Yt as buildStellarGovernanceExecuteGrantGovernanceRoleTx,eo as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,to as buildStellarGovernanceExecuteTransferGovOwnTx,Zt as buildStellarGovernanceExecuteTx,Kt as buildStellarGovernanceExecuteUpdateDelayTx,Ce as buildStellarGrantRoleTx,Io as buildStellarLendingIdentifier,H as buildStellarLiquidateTx,Q as buildStellarMigrateFromBlendTx,Oe as buildStellarMigrateTx,Z as buildStellarMultiplyTx,Ne as buildStellarPauseTx,Et as buildStellarProposeAddAssetToEModeTx,Tt as buildStellarProposeAddEModeCategoryTx,Nt as buildStellarProposeApproveBlendPoolTx,At as buildStellarProposeApproveTokenTx,Gt as buildStellarProposeConfigureMarketOracleTx,Ct as buildStellarProposeCreateLiquidityPoolTx,qt as buildStellarProposeDeployPoolTx,Vt as buildStellarProposeDisableTokenOracleTx,St as buildStellarProposeEditAssetConfigTx,It as buildStellarProposeEditAssetInEModeTx,Mt as buildStellarProposeEditOracleToleranceTx,Xt as buildStellarProposeGovernanceUpgradeTx,Ht as buildStellarProposeGrantGovernanceRoleTx,Dt as buildStellarProposeMigrateControllerTx,$t as buildStellarProposeRemoveAssetFromEModeTx,xt as buildStellarProposeRemoveEModeCategoryTx,Pt as buildStellarProposeRevokeBlendPoolTx,jt as buildStellarProposeRevokeGovernanceRoleTx,Ot as buildStellarProposeRevokeTokenTx,gt as buildStellarProposeSetAccumulatorTx,bt as buildStellarProposeSetAggregatorTx,Rt as buildStellarProposeSetMinBorrowCollatTx,vt as buildStellarProposeSetPoolTemplateTx,kt as buildStellarProposeSetPositionLimitsTx,Wt as buildStellarProposeTransferCtrlOwnershipTx,Qt as buildStellarProposeTransferGovOwnTx,Ft as buildStellarProposeUpdateDelayTx,Bt as buildStellarProposeUpdatePoolCapsTx,zt as buildStellarProposeUpgradeControllerTx,Ut as buildStellarProposeUpgradePoolParamsTx,Lt as buildStellarProposeUpgradePoolTx,Ze as buildStellarRemoveAssetFromEModeTx,Xe as buildStellarRemoveEModeCategoryTx,rt as buildStellarRenewAccountTx,X as buildStellarRepayBatchTx,Y as buildStellarRepayDebtWithCollateralTx,F as buildStellarRepayTx,Ue as buildStellarRevokeRoleTx,Ke as buildStellarRevokeTokenTx,ze as buildStellarSetAccumulatorTx,Ve as buildStellarSetAggregatorTx,De as buildStellarSetLiquidityPoolTemplateTx,Ge as buildStellarSetPositionLimitsTx,V as buildStellarSupplyBatchTx,z as buildStellarSupplyTx,K as buildStellarSwapCollateralTx,J as buildStellarSwapDebtTx,qe as buildStellarTransferOwnershipTx,Pe as buildStellarUnpauseTx,ct as buildStellarUpdateAccountThresholdTx,ot as buildStellarUpdateIndexesTx,Qe as buildStellarUpdatePoolCapsTx,Ae as buildStellarUpgradeControllerTx,nt as buildStellarUpgradeLiquidityPoolParamsTx,st as buildStellarUpgradeLiquidityPoolTx,G as buildStellarWithdrawBatchTx,M as buildStellarWithdrawTx,L as buildTx,To as decodeStellarLendingEvent,Te as encodeAssetConfigRaw,ke as encodeInterestRateModel,$e as encodeMarketOracleConfigInput,Re as encodeMarketParamsRaw,Be as encodeOracleSourceConfigInput,xe as encodePositionLimits,qo as encodeStrategyPayloadToRouteXdr,Bo as extractEventOrder,me as getStellarAccountPositions,Po as getStellarAggregatorQuote,m as getStellarAggregatorRouter,ce as getStellarAsset,ye as getStellarAssetGraph,ue as getStellarAssetMarkets,re as getStellarAssets,h as getStellarGovernance,he as getStellarGovernanceProposals,pe as getStellarHub,we as getStellarHubGraph,ae as getStellarHubs,f as getStellarLendingController,Co as getStellarQuoteTokens,ie as getStellarReserve,ge as getStellarReserveGraph,le as getStellarReserveHolders,se as getStellarReserves,de as getStellarSpoke,be as getStellarSpokeGraph,ne as getStellarSpokes,fe as getStellarUserActivity,_e as getStellarUserPositions,Wo as mapQuoteResponseToAggregatorSwap,zo as mapQuoteResponseToStrategyPayload,Do as mapQuoteResponseToStrategySwap,Ao as mapStellarPositionActivityType,Fo as prepareStellarBuiltTx,Xo as prepareStellarTxXdr,ao as stellarLendingDispatchKey,ve as stellarLendingRead,$o as syntheticEventOrder,Mo as tagStellarInvokedContractError,oo as toBase64Xdr,Ho 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 l={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},c={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},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"},_={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function f(e){const t=l[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 m(e){const t=c[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 h(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const y=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],w=e=>new t(e).toScVal(),b=e=>new a(e).toI128(),g=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),T=()=>i.ScVal.scvVoid(),x=e=>i.ScVal.scvVec(e),E=(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)},I=(e,t)=>null==e?T():t(e),$=(e,t)=>O({asset:w(t),hub_id:g(e)}),B=(e,t,o)=>i.ScVal.scvVec([$(e,t),b(o)]),A=e=>i.ScVal.scvVec(e.map((e=>B(e.hubId,e.asset,e.amount)))),O=e=>{const t=Object.keys(e).sort().map((t=>new i.ScMapEntry({key:R(t),val:e[t]})));return i.ScVal.scvMap(t)},N=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return O({amount_out:b(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 O({hops:i.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return O({paths:i.ScVal.scvVec(t),referral_id:v(e.referralId??0),token_in:w(e.tokenIn),token_out:w(e.tokenOut),total_min_out:b(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)},C=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},U=e=>{if("string"==typeof e)return P(C(e));if(e instanceof Uint8Array)return P(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?P(C(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(C(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(C(e.bytes)):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||!y.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return t})(e),i.ScVal.scvBytes(Buffer.from(N(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},q=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 L(t,a,s){const i=t.controllerAddress??f(t.network),l=new r(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??o,networkPassphrase:_[t.network]}).addOperation(l.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function V(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"supply",[w(e.caller),v(o),g(r),A([...t.assets])])}function z(e,t){return V(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function W(e,t){return L(e,"borrow",[w(e.caller),v(t.accountNonce),A([...t.borrows]),I(t.to,w)])}function D(e,t){return W(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return L(e,"withdraw",[w(e.caller),v(t.accountNonce),A([...t.withdrawals]),I(t.to,w)])}function M(e,t){return G(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function X(e,t){return L(e,"repay",[w(e.caller),v(t.accountNonce),A([...t.payments])])}function F(e,t){return X(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return L(e,"liquidate",[w(e.caller),v(t.accountNonce),A([...t.debtPayments])])}function j(e,t){return L(e,"flash_loan",[w(e.caller),$(t.hubId,t.asset),b(t.amount),w(t.receiver),q(t.data)])}function Q(e,t){return L(e,"migrate_from_blend",[w(e.caller),v(t.accountId),g(t.spokeId),g(t.hubId),w(t.blendPool),x(t.collateralTokens.map(w)),x(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),b(o)]);var t,o}))))]);var o}function Z(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"multiply",[w(e.caller),v(o),g(r),$(t.collateral.hubId,t.collateral.asset),b(t.debtToFlashLoan),$(t.debt.hubId,t.debt.asset),g(t.mode),U(t.steps),I(t.initialPayment,(e=>B(e.hubId,e.asset,e.amount))),I(t.convertSwap,U)])}function J(e,t){return L(e,"swap_debt",[w(e.caller),v(t.accountNonce),$(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),$(t.newDebt.hubId,t.newDebt.asset),U(t.steps)])}function K(e,t){return L(e,"swap_collateral",[w(e.caller),v(t.accountNonce),$(t.current.hubId,t.current.asset),b(t.fromAmount),$(t.newCollateral.hubId,t.newCollateral.asset),U(t.steps)])}function Y(e,t){return L(e,"repay_debt_with_collateral",[w(e.caller),v(t.accountNonce),$(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),$(t.debt.hubId,t.debt.asset),U(t.steps),S(t.closePosition)])}const ee="/stellar-lending",te=25,oe=encodeURIComponent,re=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),se=(e,t={},o)=>{const{hubId:r,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${ee}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ie=(e,t,o,r,a)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${o}/${oe(r)}`,a),le=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${o}/${oe(r)}/holders`,{...n,params:{side:a}}),ce=(e,t,o)=>e.fetchWithTimeout(`${ee}/assets/${oe(t)}`,o),ue=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/assets/${oe(t)}/page`,{...r,params:{...o}}),pe=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/assets/${oe(t)}/markets`,{...r,params:{side:o}}),de=(e,t,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,o),_e=(e,t,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,o),fe=(e,t,o)=>e.fetchWithTimeout(`${ee}/users/${oe(t)}/positions`,o),me=(e,t,o={},r)=>{const{skip:a,top:n}=o;return e.fetchWithTimeout(`${ee}/users/${oe(t)}/activity`,{...r,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},he=(e,t,o)=>e.fetchWithTimeout(`${ee}/accounts/${oe(t)}/positions`,o),ye=(e,t={},o)=>{const{top:r=te,continuationToken:a}=t;return e.fetchWithTimeout(`${ee}/governance/proposals`,{...o,params:{top:r,...a?{continuationToken:a}:{}}})},we=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/assets/${oe(t)}/graph`,{...r,params:{...o}}),be=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...r,params:{...o}}),ge=(e,t,o,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...r,params:{...o}}),ve=(e,t,o,r,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${o}/${oe(r)}/graph`,{...n,params:{...a}}),Se=e=>({assets:t=>re(e,t),hubs:t=>ae(e,t),spokes:t=>ne(e,t),reserves:(t,o)=>se(e,t,o),reserve:(t,o,r,a)=>ie(e,t,o,r,a),reserveHolders:(t,o,r,a,n)=>le(e,t,o,r,a,n),asset:(t,o)=>ce(e,t,o),assetMarkets:(t,o,r)=>pe(e,t,o,r),hub:(t,o)=>de(e,t,o),spoke:(t,o)=>_e(e,t,o),userPositions:(t,o)=>fe(e,t,o),userActivity:(t,o,r)=>me(e,t,o,r),accountPositions:(t,o)=>he(e,t,o),governanceProposals:(t,o)=>ye(e,t,o),assetGraph:(t,o,r)=>we(e,t,o,r),hubGraph:(t,o,r)=>be(e,t,o,r),spokeGraph:(t,o,r)=>ge(e,t,o,r),reserveGraph:(t,o,r,a,n)=>ve(e,t,o,r,a,n)}),ke={Single:0,PrimaryWithAnchor:1},Re=e=>O({base_borrow_rate_ray:b(e.baseBorrowRateRay),max_borrow_rate_ray:b(e.maxBorrowRateRay),max_utilization_ray:b(e.maxUtilizationRay),mid_utilization_ray:b(e.midUtilizationRay),optimal_utilization_ray:b(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:b(e.slope1Ray),slope2_ray:b(e.slope2Ray),slope3_ray:b(e.slope3Ray)}),Te=e=>O({asset_decimals:g(e.assetDecimals),asset_id:w(e.assetId),base_borrow_rate_ray:b(e.baseBorrowRateRay),borrow_cap:b(e.borrowCap),max_borrow_rate_ray:b(e.maxBorrowRateRay),max_utilization_ray:b(e.maxUtilizationRay),mid_utilization_ray:b(e.midUtilizationRay),optimal_utilization_ray:b(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:b(e.slope1Ray),slope2_ray:b(e.slope2Ray),slope3_ray:b(e.slope3Ray),supply_cap:b(e.supplyCap)}),xe=e=>O({asset_decimals:g(0),e_mode_categories:x(e.eModeCategories.map((e=>g(e)))),flashloan_fee_bps:g(e.flashloanFeeBps),is_borrowable:S(e.isBorrowable),is_collateralizable:S(e.isCollateralizable),is_flashloanable:S(e.isFlashloanable),liquidation_bonus_bps:g(e.liquidationBonusBps),liquidation_fees_bps:g(e.liquidationFeesBps),liquidation_threshold_bps:g(e.liquidationThresholdBps),loan_to_value_bps:g(e.loanToValueBps)}),Ee=e=>O({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Ie=e=>{const t=e.kind;switch(t){case"Stellar":return x([R("Stellar"),w(e.value)]);case"Symbol":return x([R("Symbol"),R(e.value)]);case"String":return x([R("String"),k(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},$e=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return x([R("Twap"),g(t)])}return x([R("Spot")])},Be=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return x([R("Reflector"),O({asset:Ie(e.asset),contract:w(e.contract),read_mode:$e(e.readMode,e.twapRecords)})])}if("RedStonePriceFeed"===t){if("string"!=typeof e.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof e.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return x([R("RedStone"),O({contract:w(e.contract),feed_id:k(e.feedId),max_stale_seconds:v(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Ae=e=>{const t=ke[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return O({anchor:(o=e.anchor,x(null==o?[R("None")]:[R("Some"),Be(o)])),max_price_stale_seconds:v(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:Be(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Oe(e,t){return L(e,"upgrade",[E(t.wasmHash)])}function Ne(e,t){return L(e,"migrate",[g(t.newVersion)])}function Pe(e){return L(e,"pause",[])}function Ce(e){return L(e,"unpause",[])}function Ue(e,t){return L(e,"grant_role",[w(t.account),R(t.role)])}function qe(e,t){return L(e,"revoke_role",[w(t.account),R(t.role)])}function Le(e,t){return L(e,"transfer_ownership",[w(t.newOwner),g(t.liveUntilLedger)])}function Ve(e){return L(e,"accept_ownership",[])}function ze(e,t){return L(e,"set_aggregator",[w(t.aggregator)])}function We(e,t){return L(e,"set_accumulator",[w(t.accumulator)])}function De(e,t){return L(e,"set_liquidity_pool_template",[E(t.wasmHash)])}function Ge(e,t){return L(e,"edit_asset_config",[w(t.asset),xe(t.config)])}function Me(e,t){return L(e,"set_position_limits",[Ee(t)])}function Xe(e){return L(e,"add_e_mode_category",[])}function Fe(e,t){return L(e,"remove_e_mode_category",[g(t.id)])}const He=e=>O({asset:w(e.asset),category_id:g(e.categoryId),can_collateral:S(e.canCollateral),can_borrow:S(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:b(e.supplyCap),borrow_cap:b(e.borrowCap)});function je(e,t){return L(e,"add_asset_to_e_mode_category",[He(t)])}function Qe(e,t){return L(e,"edit_asset_in_e_mode_category",[He(t)])}function Ze(e,t){return L(e,"update_pool_caps",[w(t.asset),b(t.supplyCap),b(t.borrowCap)])}function Je(e,t){return L(e,"remove_asset_from_e_mode",[w(t.asset),g(t.categoryId)])}function Ke(e,t){return L(e,"approve_token",[w(t.token)])}function Ye(e,t){return L(e,"revoke_token",[w(t.token)])}function et(e,t){return L(e,"configure_market_oracle",[w(e.caller),w(t.asset),Ae(t.config)])}function tt(e,t){return L(e,"edit_oracle_tolerance",[w(e.caller),w(t.asset),g(t.tolerance)])}function ot(e,t){return L(e,"disable_token_oracle",[w(e.caller),w(t.asset)])}function rt(e,t){return L(e,"update_indexes",[w(e.caller),x(t.assets.map((e=>w(e))))])}function at(e,t){return L(e,"renew_account",[w(e.caller),v(t.accountNonce)])}function nt(e,t){return L(e,"create_liquidity_pool",[w(t.asset),Te(t.params),xe(t.config)])}function st(e,t){return L(e,"upgrade_liquidity_pool_params",[w(t.asset),Re(t.params)])}function it(e,t){return L(e,"upgrade_liquidity_pool",[w(t.asset),E(t.wasmHash)])}function lt(e,t){return L(e,"claim_revenue",[w(e.caller),x(t.assets.map((e=>w(e))))])}function ct(e,t){return L(e,"add_rewards",[w(e.caller),x(t.rewards.map((e=>x([w(e.token),b(e.amount)]))))])}function ut(e,t){return L(e,"update_account_threshold",[w(e.caller),w(t.asset),S(t.hasRisks),x(t.accountNonces.map((e=>v(e))))])}const pt="00".repeat(32),dt=e=>{if("string"==typeof e)return E(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)},_t=(e,...t)=>x([R(e),...t]),ft=e=>O({asset:w(e.asset),category_id:g(e.categoryId),can_collateral:S(e.canCollateral),can_borrow:S(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:b(e.supplyCap),borrow_cap:b(e.borrowCap)}),mt=e=>O({new_owner:w(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),ht=e=>O({account:w(e.account),role:R(e.role)});function yt(t,a,s){const i=t.governanceAddress??h(t.network),l=new r(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??o,networkPassphrase:_[t.network]}).addOperation(l.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const wt=(e,t,o)=>yt(e,"propose",[w(e.caller),t,dt(o)]),bt=(e,t,o)=>yt(e,"execute_self",[T(),t,dt(o)]);function gt(e,t,o){return wt(e,_t("SetAggregator",w(t.aggregator)),o)}function vt(e,t,o){return wt(e,_t("SetAccumulator",w(t.accumulator)),o)}function St(e,t,o){return wt(e,_t("SetLiquidityPoolTemplate",E(t.wasmHash)),o)}function kt(e,t,o){return wt(e,_t("EditAssetConfig",w(t.asset),xe(t.config)),o)}function Rt(e,t,o){return wt(e,_t("SetPositionLimits",Ee(t)),o)}function Tt(e,t,o){return wt(e,_t("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function xt(e,t){return wt(e,_t("AddEModeCategory"),t)}function Et(e,t,o){return wt(e,_t("RemoveEModeCategory",g(t.id)),o)}function It(e,t,o){return wt(e,_t("AddAssetToEModeCategory",ft(t)),o)}function $t(e,t,o){return wt(e,_t("EditAssetInEModeCategory",ft(t)),o)}function Bt(e,t,o){return wt(e,_t("UpdatePoolCaps",O({asset:w((r=t).asset),supply_cap:b(r.supplyCap),borrow_cap:b(r.borrowCap)})),o);var r}function At(e,t,o){return wt(e,_t("RemoveAssetFromEMode",O({asset:w((r=t).asset),category_id:g(r.categoryId)})),o);var r}function Ot(e,t,o){return wt(e,_t("ApproveToken",w(t.token)),o)}function Nt(e,t,o){return wt(e,_t("RevokeToken",w(t.token)),o)}function Pt(e,t,o){return wt(e,_t("ApproveBlendPool",w(t.pool)),o)}function Ct(e,t,o){return wt(e,_t("RevokeBlendPool",w(t.pool)),o)}function Ut(e,t,o){return wt(e,_t("CreateLiquidityPool",O({asset:w((r=t).asset),params:Te(r.params),config:xe(r.config)})),o);var r}function qt(e,t,o){return wt(e,_t("UpgradeLiquidityPoolParams",O({asset:w((r=t).asset),params:Re(r.params)})),o);var r}function Lt(e,t){return wt(e,_t("DeployPool"),t)}function Vt(e,t,o){return wt(e,_t("UpgradePool",E(t.wasmHash)),o)}function zt(e,t,o){return wt(e,_t("DisableTokenOracle",w(t.asset)),o)}function Wt(e,t,o){return wt(e,_t("UpgradeController",E(t.wasmHash)),o)}function Dt(e,t,o){return wt(e,_t("MigrateController",g(t.newVersion)),o)}function Gt(e,t,o){return wt(e,_t("TransferCtrlOwnership",mt(t)),o)}function Mt(e,t,o){return wt(e,_t("ConfigureMarketOracle",O({asset:w((r=t).asset),cfg:Ae(r.config)})),o);var r}function Xt(e,t,o){return wt(e,_t("EditOracleTolerance",O({asset:w((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Ft(e,t,o){return wt(e,_t("UpgradeGov",E(t.wasmHash)),o)}function Ht(e,t,o){return wt(e,_t("UpdateGovDelay",g(t.newDelay)),o)}function jt(e,t,o){return wt(e,_t("GrantGovRole",ht(t)),o)}function Qt(e,t,o){return wt(e,_t("RevokeGovRole",ht(t)),o)}function Zt(e,t,o){return wt(e,_t("TransferGovOwnership",mt(t)),o)}function Jt(e,t){const o=x(t.argsXdr.map((e=>i.ScVal.fromXDR(e,"base64")))),r=dt(t.predecessor??pt);return yt(e,"execute",[T(),w(t.target),R(t.functionName),o,r,dt(t.salt)])}function Kt(e,t,o){return bt(e,_t("UpgradeGov",E(t.wasmHash)),o)}function Yt(e,t,o){return bt(e,_t("UpdateGovDelay",g(t.newDelay)),o)}function eo(e,t,o){return bt(e,_t("GrantGovRole",ht(t)),o)}function to(e,t,o){return bt(e,_t("RevokeGovRole",ht(t)),o)}function oo(e,t,o){return bt(e,_t("TransferGovOwnership",mt(t)),o)}const ro=e=>e.toXDR("base64"),ao=e=>i.ScVal.fromXDR(e,"base64"),no=e=>e.map((e=>String(s(ao(e))))).join(":"),so=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),io=e=>Number(e),lo=e=>String(e),co=e=>null==e?void 0:so(e),uo=e=>null==e?void 0:lo(e),po=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),_o=["None","Multiply","Long","Short"],fo=["Single","PrimaryWithAnchor"],mo=["ReflectorSep40","RedStonePriceFeed"],ho=["Spot","Twap"],yo=["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"],wo=e=>Array.isArray(e)?e:[],bo=e=>({loanToValueBps:io(e.loan_to_value_bps),liquidationThresholdBps:io(e.liquidation_threshold_bps),liquidationBonusBps:io(e.liquidation_bonus_bps),liquidationFeesBps:io(e.liquidation_fees_bps),isCollateralizable:Boolean(e.is_collateralizable),isBorrowable:Boolean(e.is_borrowable),isFlashloanable:Boolean(e.is_flashloanable),flashloanFeeBps:io(e.flashloan_fee_bps),eModeCategories:(e.e_mode_categories??[]).map(io)}),go=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],yo[io(r)]??so(r)),positionType:t,asset:lo(e[1]),scaledAmountRay:so(e[2]),indexRay:so(e[3]),amount:so(e[4]),liquidationThresholdBps:o?void 0:io(e[5]),liquidationBonusBps:o?void 0:io(e[6]),loanToValueBps:o?void 0:io(e[7])};var r},vo=e=>{return{owner:lo(e[0]),eModeCategoryId:io(e[1]),mode:(t=e[2],_o[io(t)]??"None")};var t},So=(e,t)=>{const o=ho[io(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:mo[io(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:lo(e[`${t}_contract`]),asset:n,feedId:uo(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?io(e[`${t}_twap_records`]):void 0,decimals:io(e[`${t}_decimals`]),resolutionSeconds:io(e[`${t}_resolution_seconds`]),maxStaleSeconds:io(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:io(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:io(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:io(e.asset_decimals),maxPriceStaleSeconds:io(e.max_price_stale_seconds),strategy:fo[io(e.strategy)]??"Single",primary:So(e,"primary"),anchor:t?So(e,"anchor"):void 0,primaryQuoteToken:uo(e.primary_quote_token),anchorQuoteToken:uo(e.anchor_quote_token),minSanityPriceWad:co(e.min_sanity_price_wad),maxSanityPriceWad:co(e.max_sanity_price_wad)}},Ro={"market:create":e=>({topic:"market:create",data:{baseAsset:lo(e.base_asset),maxBorrowRate:so(e.max_borrow_rate),baseBorrowRate:so(e.base_borrow_rate),slope1:so(e.slope1),slope2:so(e.slope2),slope3:so(e.slope3),midUtilization:so(e.mid_utilization),optimalUtilization:so(e.optimal_utilization),maxUtilization:co(e.max_utilization),reserveFactor:io(e.reserve_factor),marketAddress:lo(e.market_address),config:bo(e.config)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:lo(e.asset),maxBorrowRateRay:so(e.max_borrow_rate_ray),baseBorrowRateRay:so(e.base_borrow_rate_ray),slope1Ray:so(e.slope1_ray),slope2Ray:so(e.slope2_ray),slope3Ray:so(e.slope3_ray),midUtilizationRay:so(e.mid_utilization_ray),optimalUtilizationRay:so(e.optimal_utilization_ray),maxUtilizationRay:co(e.max_utilization_ray),reserveFactorBps:io(e.reserve_factor_bps)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:wo(e).map((e=>{return t=wo(e),{asset:lo(t[0]),timestamp:io(t[1]),supplyIndexRay:so(t[2]),borrowIndexRay:so(t[3]),reservesRay:so(t[4]),suppliedRay:so(t[5]),borrowedRay:so(t[6]),revenueRay:so(t[7]),assetPriceWad:co(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:wo(e).map((e=>{const t=e;return{asset:lo(t.asset),params:(o=t.params,{maxBorrowRateRay:so(o.max_borrow_rate_ray),baseBorrowRateRay:so(o.base_borrow_rate_ray),slope1Ray:so(o.slope1_ray),slope2Ray:so(o.slope2_ray),slope3Ray:so(o.slope3_ray),midUtilizationRay:so(o.mid_utilization_ray),optimalUtilizationRay:so(o.optimal_utilization_ray),maxUtilizationRay:co(o.max_utilization_ray),reserveFactorBps:io(o.reserve_factor_bps),supplyCap:so(o.supply_cap),borrowCap:so(o.borrow_cap),assetId:uo(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:io(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=wo(e);return{topic:"position:batch_update",data:{accountId:so(t[0]),accountAttributes:vo(wo(t[1])),updates:[...wo(t[2]).map((e=>go(wo(e),"Deposit"))),...wo(t[3]).map((e=>go(wo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{asset:lo(e.asset),receiver:lo(e.receiver),caller:lo(e.caller),amount:so(e.amount),fee:so(e.fee)}}),"config:asset":e=>({topic:"config:asset",data:{asset:lo(e.asset),config:bo(e.config)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:lo(e.asset),oracle:ko(e.oracle)}}),"config:emode_category":e=>({topic:"config:emode_category",data:{category:{categoryId:io(e.category.category_id),isDeprecated:Boolean(e.category.is_deprecated)}}}),"config:emode_asset":e=>({topic:"config:emode_asset",data:{asset:lo(e.asset),config:{isCollateralizable:Boolean(e.config.is_collateralizable),isBorrowable:Boolean(e.config.is_borrowable),loanToValueBps:io(e.config.loan_to_value_bps),liquidationThresholdBps:io(e.config.liquidation_threshold_bps),liquidationBonusBps:io(e.config.liquidation_bonus_bps),supplyCap:so(e.config.supply_cap),borrowCap:so(e.config.borrow_cap)},categoryId:io(e.category_id)}}),"config:remove_emode_asset":e=>({topic:"config:remove_emode_asset",data:{asset:lo(e.asset),categoryId:io(e.category_id)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:so(e.account_id),totalBorrowUsdWad:so(e.total_borrow_usd_wad),totalCollateralUsdWad:so(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:lo(e.token),amount:so(e.amount),usdValueWad:so(e.usd_value_wad),accountId:so(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{asset:lo(e.asset),amount:so(e.amount),fee:so(e.fee),amountSent:so(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:po(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:po(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:io(e.max_supply_positions),maxBorrowPositions:io(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:lo(e.asset)}})},To=Object.freeze(Object.keys(Ro));function xo(e,t){const o=no(e),r=Ro[o];return r?r(s(ao(t))):null}const Eo="XLENDXLM-a7c9f3",Io=1e4;function $o(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${Eo}-${o}`}function Bo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Ao(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 No=(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 Co(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=No(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 Uo(e){const t=No(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 qo=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,Lo=e=>N(e).toXDR("base64");function Vo(t,a){const s=t.routerAddress??m(t.network),i=new r(s),l=new e(t.caller,t.sourceSequence),c=U(qo(a,t.referralId));return{xdr:new n(l,{fee:t.fee??o,networkPassphrase:_[t.network]}).addOperation(i.call("execute_strategy",w(t.caller),b(t.totalIn),c)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function zo(e,t){return Vo(e,t)}function Wo(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(Mo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Mo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Do(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Wo(e,t)}const Go=Wo,Mo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Xo(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Fo(e,t,o){const r=n.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Xo(o.invokedContractId,e);throw e}}async function Ho(e,t,o){return Fo(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{paths:[{hops:[{amountOut:"0",pool:e,tokenIn:e,tokenOut:e,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:e,tokenOut:e,totalMinOut:t}}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:_[t.network]}).addOperation(a).setTimeout(t.timeoutSeconds??120).build().toXDR()}}export{c as STELLAR_AGGREGATOR_ROUTER,u as STELLAR_GOVERNANCE,pt as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,l as STELLAR_LENDING_CONTROLLER,To as STELLAR_LENDING_TOPICS,_ as STELLAR_NETWORK_PASSPHRASE,d as STELLAR_QUOTE_URL,p as STELLAR_SOROBAN_RPC_URL,Io as SYNTHETIC_EVENT_ORDER_STRIDE,Eo as XOXNO_LENDING_STELLAR_TICKER,Qo as buildSameTokenRepaySwapSteps,Ve as buildStellarAcceptOwnershipTx,je as buildStellarAddAssetToEModeCategoryTx,Xe as buildStellarAddEModeCategoryTx,ct as buildStellarAddRewardsTx,Ke as buildStellarApproveTokenTx,zo as buildStellarBatchSwapTx,W as buildStellarBorrowBatchTx,D as buildStellarBorrowTx,Jo as buildStellarCctpForwardTx,lt as buildStellarClaimRevenueTx,et as buildStellarConfigureMarketOracleTx,nt as buildStellarCreateLiquidityPoolTx,ot as buildStellarDisableTokenOracleTx,Ge as buildStellarEditAssetConfigTx,Qe as buildStellarEditAssetInEModeCategoryTx,tt as buildStellarEditOracleToleranceTx,Vo as buildStellarExecuteStrategyTx,j as buildStellarFlashLoanTx,Kt as buildStellarGovernanceExecuteGovernanceUpgradeTx,eo as buildStellarGovernanceExecuteGrantGovernanceRoleTx,to as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,oo as buildStellarGovernanceExecuteTransferGovOwnTx,Jt as buildStellarGovernanceExecuteTx,Yt as buildStellarGovernanceExecuteUpdateDelayTx,Ue as buildStellarGrantRoleTx,$o as buildStellarLendingIdentifier,H as buildStellarLiquidateTx,Q as buildStellarMigrateFromBlendTx,Ne as buildStellarMigrateTx,Z as buildStellarMultiplyTx,Pe as buildStellarPauseTx,It as buildStellarProposeAddAssetToEModeTx,xt as buildStellarProposeAddEModeCategoryTx,Pt as buildStellarProposeApproveBlendPoolTx,Ot as buildStellarProposeApproveTokenTx,Mt as buildStellarProposeConfigureMarketOracleTx,Ut as buildStellarProposeCreateLiquidityPoolTx,Lt as buildStellarProposeDeployPoolTx,zt as buildStellarProposeDisableTokenOracleTx,kt as buildStellarProposeEditAssetConfigTx,$t as buildStellarProposeEditAssetInEModeTx,Xt as buildStellarProposeEditOracleToleranceTx,Ft as buildStellarProposeGovernanceUpgradeTx,jt as buildStellarProposeGrantGovernanceRoleTx,Dt as buildStellarProposeMigrateControllerTx,At as buildStellarProposeRemoveAssetFromEModeTx,Et as buildStellarProposeRemoveEModeCategoryTx,Ct as buildStellarProposeRevokeBlendPoolTx,Qt as buildStellarProposeRevokeGovernanceRoleTx,Nt as buildStellarProposeRevokeTokenTx,vt as buildStellarProposeSetAccumulatorTx,gt as buildStellarProposeSetAggregatorTx,Tt as buildStellarProposeSetMinBorrowCollatTx,St as buildStellarProposeSetPoolTemplateTx,Rt as buildStellarProposeSetPositionLimitsTx,Gt as buildStellarProposeTransferCtrlOwnershipTx,Zt as buildStellarProposeTransferGovOwnTx,Ht as buildStellarProposeUpdateDelayTx,Bt as buildStellarProposeUpdatePoolCapsTx,Wt as buildStellarProposeUpgradeControllerTx,qt as buildStellarProposeUpgradePoolParamsTx,Vt as buildStellarProposeUpgradePoolTx,Je as buildStellarRemoveAssetFromEModeTx,Fe as buildStellarRemoveEModeCategoryTx,at as buildStellarRenewAccountTx,X as buildStellarRepayBatchTx,Y as buildStellarRepayDebtWithCollateralTx,F as buildStellarRepayTx,qe as buildStellarRevokeRoleTx,Ye as buildStellarRevokeTokenTx,We as buildStellarSetAccumulatorTx,ze as buildStellarSetAggregatorTx,De as buildStellarSetLiquidityPoolTemplateTx,Me as buildStellarSetPositionLimitsTx,V as buildStellarSupplyBatchTx,z as buildStellarSupplyTx,K as buildStellarSwapCollateralTx,J as buildStellarSwapDebtTx,Le as buildStellarTransferOwnershipTx,Ce as buildStellarUnpauseTx,ut as buildStellarUpdateAccountThresholdTx,rt as buildStellarUpdateIndexesTx,Ze as buildStellarUpdatePoolCapsTx,Oe as buildStellarUpgradeControllerTx,st as buildStellarUpgradeLiquidityPoolParamsTx,it as buildStellarUpgradeLiquidityPoolTx,G as buildStellarWithdrawBatchTx,M as buildStellarWithdrawTx,L as buildTx,xo as decodeStellarLendingEvent,xe as encodeAssetConfigRaw,Re as encodeInterestRateModel,Ae as encodeMarketOracleConfigInput,Te as encodeMarketParamsRaw,Be as encodeOracleSourceConfigInput,Ee as encodePositionLimits,Lo as encodeStrategyPayloadToRouteXdr,Bo as extractEventOrder,he as getStellarAccountPositions,Co as getStellarAggregatorQuote,m as getStellarAggregatorRouter,ce as getStellarAsset,we as getStellarAssetGraph,pe as getStellarAssetMarkets,ue as getStellarAssetPage,re as getStellarAssets,h as getStellarGovernance,ye as getStellarGovernanceProposals,de as getStellarHub,be as getStellarHubGraph,ae as getStellarHubs,f as getStellarLendingController,Uo as getStellarQuoteTokens,ie as getStellarReserve,ve as getStellarReserveGraph,le as getStellarReserveHolders,se as getStellarReserves,_e as getStellarSpoke,ge as getStellarSpokeGraph,ne as getStellarSpokes,me as getStellarUserActivity,fe as getStellarUserPositions,Go as mapQuoteResponseToAggregatorSwap,Wo as mapQuoteResponseToStrategyPayload,Do as mapQuoteResponseToStrategySwap,Oo as mapStellarPositionActivityType,Ho as prepareStellarBuiltTx,Fo as prepareStellarTxXdr,no as stellarLendingDispatchKey,Se as stellarLendingRead,Ao as syntheticEventOrder,Xo as tagStellarInvokedContractError,ro as toBase64Xdr,jo as toStellarPositionMode};
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* Numeric `*Wad`/`*Ray`/`*ScaledRay` fields cross the wire as decimal strings
|
|
11
11
|
* (1e18 / 1e27 fixed-point); `*Short` fields are already human-readable numbers.
|
|
12
12
|
*/
|
|
13
|
-
import type { StellarGovernanceProposalField, StellarGovernanceProposalKind, StellarGovernanceProposalStatus, StellarGovernanceProposalTarget, StellarInitialPaymentMultiplier } from '@xoxno/types/stellar-lending';
|
|
13
|
+
import type { StellarAssetPage, StellarAssetPageGraphPoint, StellarAssetPageGraphSeries, StellarAssetPageMarket, StellarGovernanceProposalField, StellarGovernanceProposalKind, StellarGovernanceProposalStatus, StellarGovernanceProposalTarget, StellarInitialPaymentMultiplier } from '@xoxno/types/stellar-lending';
|
|
14
|
+
export type { StellarAssetPage, StellarAssetPageGraphPoint, StellarAssetPageGraphSeries, StellarAssetPageMarket, };
|
|
14
15
|
/** Side selector for an asset's markets table. */
|
|
15
16
|
export type StellarLendingMarketSide = 'deposit' | 'borrow';
|
|
16
17
|
/** Side selector for a reserve's top-holders list. */
|
|
@@ -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, StellarHubListItem, StellarReserveListItem, StellarSpokeListItem, StellarUserActivityItem } from '@xoxno/types/stellar-lending';
|
|
14
|
+
import type { StellarAssetListItem, StellarAssetPage, StellarHubListItem, 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, StellarLendingMarketSide, StellarMarketGraph, StellarMarketGraphQuery, StellarReserve, StellarSpoke, StellarTopHolders } from './lending-read-types';
|
|
17
17
|
/** Every asset, aggregated across hubs — rows for the Deposit/Borrow tables. */
|
|
@@ -36,6 +36,10 @@ export declare const getStellarReserve: (client: XOXNOClient, spokeId: number, h
|
|
|
36
36
|
export declare const getStellarReserveHolders: (client: XOXNOClient, spokeId: number, hubId: number, asset: string, side: StellarLendingHoldersSide, init?: OurRequestInit) => Promise<StellarTopHolders>;
|
|
37
37
|
/** Asset overview: header totals + APY ranges. */
|
|
38
38
|
export declare const getStellarAsset: (client: XOXNOClient, asset: string, init?: OurRequestInit) => Promise<StellarAsset>;
|
|
39
|
+
/** Asset detail page: overview + deposit/borrow markets + spoke APY series. */
|
|
40
|
+
export declare const getStellarAssetPage: (client: XOXNOClient, asset: string, query: StellarMarketGraphQuery & {
|
|
41
|
+
owner?: string;
|
|
42
|
+
}, init?: OurRequestInit) => Promise<StellarAssetPage>;
|
|
39
43
|
/** Asset markets (per spoke/hub) for one side. */
|
|
40
44
|
export declare const getStellarAssetMarkets: (client: XOXNOClient, asset: string, side: StellarLendingMarketSide, init?: OurRequestInit) => Promise<StellarAssetMarket[]>;
|
|
41
45
|
/** Hub overview: totals + per-asset opportunities. */
|
|
@@ -181,6 +181,7 @@ export interface StellarRepayDebtWithCollateralArgs {
|
|
|
181
181
|
export interface StellarMigrateFromBlendArgs {
|
|
182
182
|
accountId: number | string;
|
|
183
183
|
spokeId: number;
|
|
184
|
+
hubId: number;
|
|
184
185
|
blendPool: string;
|
|
185
186
|
collateralTokens: ReadonlyArray<string>;
|
|
186
187
|
supplyTokens: ReadonlyArray<string>;
|
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, 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, 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": {
|
|
@@ -898,6 +898,255 @@ export declare const endpoints: {
|
|
|
898
898
|
readonly securityMode: "requiredAny";
|
|
899
899
|
};
|
|
900
900
|
};
|
|
901
|
+
readonly "/stellar-lending/assets": {
|
|
902
|
+
readonly input: {};
|
|
903
|
+
readonly output: StellarAssetListItemDto[];
|
|
904
|
+
};
|
|
905
|
+
readonly "/stellar-lending/hubs": {
|
|
906
|
+
readonly input: {};
|
|
907
|
+
readonly output: StellarHubListItemDto[];
|
|
908
|
+
};
|
|
909
|
+
readonly "/stellar-lending/spokes": {
|
|
910
|
+
readonly input: {};
|
|
911
|
+
readonly output: StellarSpokeListItemDto[];
|
|
912
|
+
};
|
|
913
|
+
readonly "/stellar-lending/reserves": {
|
|
914
|
+
readonly input: {
|
|
915
|
+
hubId?: number;
|
|
916
|
+
spokeId?: number;
|
|
917
|
+
asset?: string;
|
|
918
|
+
};
|
|
919
|
+
readonly output: StellarReserveListItemDto[];
|
|
920
|
+
};
|
|
921
|
+
readonly "/stellar-lending/reserves/:spokeId/:hubId/:asset": {
|
|
922
|
+
readonly input: {};
|
|
923
|
+
readonly output: ReserveDto;
|
|
924
|
+
};
|
|
925
|
+
readonly "/stellar-lending/reserves/:spokeId/:hubId/:asset/holders": {
|
|
926
|
+
readonly input: {
|
|
927
|
+
side: string;
|
|
928
|
+
};
|
|
929
|
+
readonly output: TopHoldersDto;
|
|
930
|
+
};
|
|
931
|
+
readonly "/stellar-lending/hubs/:hubId/holders": {
|
|
932
|
+
readonly input: {
|
|
933
|
+
side: string;
|
|
934
|
+
};
|
|
935
|
+
readonly output: TopHoldersDto;
|
|
936
|
+
};
|
|
937
|
+
readonly "/stellar-lending/spokes/:spokeId/holders": {
|
|
938
|
+
readonly input: {
|
|
939
|
+
side: string;
|
|
940
|
+
};
|
|
941
|
+
readonly output: TopHoldersDto;
|
|
942
|
+
};
|
|
943
|
+
readonly "/stellar-lending/assets/:asset": {
|
|
944
|
+
readonly input: {};
|
|
945
|
+
readonly output: AssetDto;
|
|
946
|
+
};
|
|
947
|
+
readonly "/stellar-lending/assets/:asset/page": {
|
|
948
|
+
readonly input: {
|
|
949
|
+
from: string;
|
|
950
|
+
to: string;
|
|
951
|
+
bin: string;
|
|
952
|
+
owner?: string;
|
|
953
|
+
};
|
|
954
|
+
readonly output: AssetPageDto;
|
|
955
|
+
};
|
|
956
|
+
readonly "/stellar-lending/assets/:asset/markets": {
|
|
957
|
+
readonly input: {
|
|
958
|
+
side: string;
|
|
959
|
+
};
|
|
960
|
+
readonly output: AssetMarketDto[];
|
|
961
|
+
};
|
|
962
|
+
readonly "/stellar-lending/hubs/:hubId": {
|
|
963
|
+
readonly input: {};
|
|
964
|
+
readonly output: HubDto;
|
|
965
|
+
};
|
|
966
|
+
readonly "/stellar-lending/spokes/:spokeId": {
|
|
967
|
+
readonly input: {};
|
|
968
|
+
readonly output: SpokeDto;
|
|
969
|
+
};
|
|
970
|
+
readonly "/stellar-lending/users/:owner/positions": {
|
|
971
|
+
readonly input: {};
|
|
972
|
+
readonly output: AccountPositionsDto;
|
|
973
|
+
};
|
|
974
|
+
readonly "/stellar-lending/users/:owner/activity": {
|
|
975
|
+
readonly input: {
|
|
976
|
+
skip?: number;
|
|
977
|
+
top?: number;
|
|
978
|
+
};
|
|
979
|
+
readonly output: StellarUserActivityItemDto[];
|
|
980
|
+
};
|
|
981
|
+
readonly "/stellar-lending/accounts/:accountId/positions": {
|
|
982
|
+
readonly input: {};
|
|
983
|
+
readonly output: AccountPositionsDto;
|
|
984
|
+
};
|
|
985
|
+
readonly "/stellar-lending/governance/proposals": {
|
|
986
|
+
readonly input: {
|
|
987
|
+
top?: number;
|
|
988
|
+
continuationToken?: string;
|
|
989
|
+
};
|
|
990
|
+
readonly output: GovernanceProposalsPageDto;
|
|
991
|
+
};
|
|
992
|
+
readonly "/stellar-lending/assets/:asset/graph": {
|
|
993
|
+
readonly input: {
|
|
994
|
+
from: string;
|
|
995
|
+
to: string;
|
|
996
|
+
bin: string;
|
|
997
|
+
};
|
|
998
|
+
readonly output: MarketGraphDto;
|
|
999
|
+
};
|
|
1000
|
+
readonly "/stellar-lending/hubs/:hubId/graph": {
|
|
1001
|
+
readonly input: {
|
|
1002
|
+
from: string;
|
|
1003
|
+
to: string;
|
|
1004
|
+
bin: string;
|
|
1005
|
+
};
|
|
1006
|
+
readonly output: MarketGraphDto;
|
|
1007
|
+
};
|
|
1008
|
+
readonly "/stellar-lending/spokes/:spokeId/graph": {
|
|
1009
|
+
readonly input: {
|
|
1010
|
+
from: string;
|
|
1011
|
+
to: string;
|
|
1012
|
+
bin: string;
|
|
1013
|
+
};
|
|
1014
|
+
readonly output: SpokeGraphDto;
|
|
1015
|
+
};
|
|
1016
|
+
readonly "/stellar-lending/reserves/:spokeId/:hubId/:asset/graph": {
|
|
1017
|
+
readonly input: {
|
|
1018
|
+
from: string;
|
|
1019
|
+
to: string;
|
|
1020
|
+
bin: string;
|
|
1021
|
+
};
|
|
1022
|
+
readonly output: MarketGraphDto;
|
|
1023
|
+
};
|
|
1024
|
+
readonly "/stellar-lending/stats/history": {
|
|
1025
|
+
readonly input: {
|
|
1026
|
+
from: string;
|
|
1027
|
+
to: string;
|
|
1028
|
+
bin: string;
|
|
1029
|
+
};
|
|
1030
|
+
readonly output: StellarStatsHistoryDto;
|
|
1031
|
+
};
|
|
1032
|
+
readonly "/stellar-lending/pnl": {
|
|
1033
|
+
readonly input: {
|
|
1034
|
+
accountId: string;
|
|
1035
|
+
};
|
|
1036
|
+
readonly output: StellarPositionsPnlDto;
|
|
1037
|
+
};
|
|
1038
|
+
readonly "/stellar-lending/positions": {
|
|
1039
|
+
readonly input: {
|
|
1040
|
+
token?: string;
|
|
1041
|
+
orderBy?: string;
|
|
1042
|
+
orderDirection?: string;
|
|
1043
|
+
skip?: number;
|
|
1044
|
+
top?: number;
|
|
1045
|
+
};
|
|
1046
|
+
readonly output: StellarPositionsRankDto;
|
|
1047
|
+
};
|
|
1048
|
+
readonly "/stellar-lending/users/:accountId/history": {
|
|
1049
|
+
readonly input: {
|
|
1050
|
+
from: string;
|
|
1051
|
+
to: string;
|
|
1052
|
+
bin: string;
|
|
1053
|
+
};
|
|
1054
|
+
readonly output: UserHistoryDto;
|
|
1055
|
+
};
|
|
1056
|
+
readonly "/stellar-lending/pnl/scope": {
|
|
1057
|
+
readonly input: {
|
|
1058
|
+
scope: string;
|
|
1059
|
+
};
|
|
1060
|
+
readonly output: PnlByScopeDto;
|
|
1061
|
+
};
|
|
1062
|
+
readonly "/stellar-lending/revenue": {
|
|
1063
|
+
readonly input: {
|
|
1064
|
+
from: string;
|
|
1065
|
+
to: string;
|
|
1066
|
+
bin: string;
|
|
1067
|
+
scope?: string;
|
|
1068
|
+
};
|
|
1069
|
+
readonly output: RevenueSeriesDto;
|
|
1070
|
+
};
|
|
1071
|
+
readonly "/stellar-lending/revenue/fees": {
|
|
1072
|
+
readonly input: {
|
|
1073
|
+
from: string;
|
|
1074
|
+
to: string;
|
|
1075
|
+
bin: string;
|
|
1076
|
+
hubId?: number;
|
|
1077
|
+
};
|
|
1078
|
+
readonly output: FeeRevenueSeriesDto;
|
|
1079
|
+
};
|
|
1080
|
+
readonly "/stellar-lending/participants": {
|
|
1081
|
+
readonly input: {
|
|
1082
|
+
hubId?: number;
|
|
1083
|
+
spokeId?: number;
|
|
1084
|
+
token?: string;
|
|
1085
|
+
};
|
|
1086
|
+
readonly output: ParticipantCountsDto;
|
|
1087
|
+
};
|
|
1088
|
+
readonly "/stellar-lending/liquidations": {
|
|
1089
|
+
readonly input: {
|
|
1090
|
+
from: string;
|
|
1091
|
+
to: string;
|
|
1092
|
+
bin: string;
|
|
1093
|
+
hubId?: number;
|
|
1094
|
+
};
|
|
1095
|
+
readonly output: LiquidationsSeriesDto;
|
|
1096
|
+
};
|
|
1097
|
+
readonly "/stellar-lending/liquidations/leaderboard": {
|
|
1098
|
+
readonly input: {
|
|
1099
|
+
top?: number;
|
|
1100
|
+
hubId?: number;
|
|
1101
|
+
token?: string;
|
|
1102
|
+
};
|
|
1103
|
+
readonly output: LiquidationsLeaderboardDto;
|
|
1104
|
+
};
|
|
1105
|
+
readonly "/stellar-lending/volume": {
|
|
1106
|
+
readonly input: {
|
|
1107
|
+
from: string;
|
|
1108
|
+
to: string;
|
|
1109
|
+
bin: string;
|
|
1110
|
+
hubId?: number;
|
|
1111
|
+
token?: string;
|
|
1112
|
+
};
|
|
1113
|
+
readonly output: VolumeSeriesDto;
|
|
1114
|
+
};
|
|
1115
|
+
readonly "/stellar-lending/active-users": {
|
|
1116
|
+
readonly input: {
|
|
1117
|
+
from: string;
|
|
1118
|
+
to: string;
|
|
1119
|
+
bin: string;
|
|
1120
|
+
};
|
|
1121
|
+
readonly output: ActiveUsersSeriesDto;
|
|
1122
|
+
};
|
|
1123
|
+
readonly "/stellar-lending/distribution": {
|
|
1124
|
+
readonly input: {
|
|
1125
|
+
hubId?: number;
|
|
1126
|
+
spokeId?: number;
|
|
1127
|
+
token?: string;
|
|
1128
|
+
side?: string;
|
|
1129
|
+
};
|
|
1130
|
+
readonly output: HolderDistributionDto;
|
|
1131
|
+
};
|
|
1132
|
+
readonly "/stellar-lending/rate-spread": {
|
|
1133
|
+
readonly input: {
|
|
1134
|
+
from: string;
|
|
1135
|
+
to: string;
|
|
1136
|
+
bin: string;
|
|
1137
|
+
hubId?: number;
|
|
1138
|
+
token?: string;
|
|
1139
|
+
};
|
|
1140
|
+
readonly output: RateSpreadSeriesDto;
|
|
1141
|
+
};
|
|
1142
|
+
readonly "/stellar-lending/defillama": {
|
|
1143
|
+
readonly input: {
|
|
1144
|
+
from: string;
|
|
1145
|
+
to: string;
|
|
1146
|
+
bin: string;
|
|
1147
|
+
};
|
|
1148
|
+
readonly output: DefiLlamaDimensionsDto;
|
|
1149
|
+
};
|
|
901
1150
|
readonly "/user/notifications": {
|
|
902
1151
|
readonly input: {
|
|
903
1152
|
skip?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.170",
|
|
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.446"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
120
|
"@stellar/stellar-sdk": ">=15.0.0 <17.0.0"
|