@xoxno/sdk-js 1.0.159 → 1.0.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,259 @@
1
+ /**
2
+ * Stellar lending read-API response shapes.
3
+ *
4
+ * These interfaces mirror the api-v2 `stellar-lending` response DTOs 1:1. The
5
+ * SDK never imports from api-v2, so the shapes are duplicated here by hand. Doc
6
+ * field types that already live in `@xoxno/types/stellar-lending` (governance
7
+ * enums + proposal fields, the initial-payment multiplier) are imported rather
8
+ * than re-declared.
9
+ *
10
+ * Numeric `*Wad`/`*Ray`/`*ScaledRay` fields cross the wire as decimal strings
11
+ * (1e18 / 1e27 fixed-point); `*Short` fields are already human-readable numbers.
12
+ */
13
+ import type { StellarGovernanceProposalField, StellarGovernanceProposalKind, StellarGovernanceProposalStatus, StellarGovernanceProposalTarget, StellarInitialPaymentMultiplier } from '@xoxno/types/stellar-lending';
14
+ /** Side selector for an asset's markets table. */
15
+ export type StellarLendingMarketSide = 'deposit' | 'borrow';
16
+ /** Side selector for a reserve's top-holders list. */
17
+ export type StellarLendingHoldersSide = 'deposits' | 'borrows';
18
+ /** One (spoke, hub) market row for an asset's markets table. */
19
+ export interface StellarAssetMarket {
20
+ spokeId: number;
21
+ hubId: number;
22
+ asset: string;
23
+ supplyApy: number;
24
+ borrowApy: number;
25
+ utilization: number;
26
+ suppliedShort: number;
27
+ borrowedShort: number;
28
+ availableLiquidityShort: number;
29
+ collateralFactorBps: number;
30
+ liquidationThresholdBps: number;
31
+ isCollateralizable: boolean;
32
+ isBorrowable: boolean;
33
+ }
34
+ /** Asset overview header: identity + protocol-wide aggregates + APY ranges. */
35
+ export interface StellarAsset {
36
+ asset: string;
37
+ symbol: string;
38
+ name: string;
39
+ decimals: number;
40
+ usdPriceWad: string;
41
+ usdPriceShort: number;
42
+ totalDepositsUsd: string;
43
+ totalBorrowsUsd: string;
44
+ availableLiquidityUsd: string;
45
+ hubCount: number;
46
+ reserveCount: number;
47
+ minSupplyApy: number;
48
+ maxSupplyApy: number;
49
+ minBorrowApy: number;
50
+ maxBorrowApy: number;
51
+ }
52
+ /** One asset's liquidity on a hub, rendered as a hub opportunity row. */
53
+ export interface StellarHubAssetRow {
54
+ hubId: number;
55
+ asset: string;
56
+ supplyApy: number;
57
+ borrowApy: number;
58
+ utilization: number;
59
+ suppliedShort: number;
60
+ borrowedShort: number;
61
+ availableLiquidityShort: number;
62
+ isFlashloanable: boolean;
63
+ }
64
+ /** Hub overview: header totals + per-asset liquidity opportunities. */
65
+ export interface StellarHub {
66
+ hubId: number;
67
+ isActive: boolean;
68
+ name: string | null;
69
+ totalDepositsUsd: string;
70
+ totalBorrowsUsd: string;
71
+ availableLiquidityUsd: string;
72
+ utilization: number;
73
+ assetCount: number;
74
+ assets: StellarHubAssetRow[];
75
+ }
76
+ /** One reserve row within a spoke (risk truth joined with hub liquidity). */
77
+ export interface StellarSpokeMarket {
78
+ spokeId: number;
79
+ hubId: number;
80
+ asset: string;
81
+ supplyApy: number;
82
+ borrowApy: number;
83
+ utilization: number;
84
+ availableLiquidityShort: number;
85
+ collateralFactorBps: number;
86
+ liquidationThresholdBps: number;
87
+ isCollateralizable: boolean;
88
+ isBorrowable: boolean;
89
+ paused: boolean;
90
+ frozen: boolean;
91
+ }
92
+ /** Spoke overview: header totals, connected hubs, and per-reserve market table. */
93
+ export interface StellarSpoke {
94
+ spokeId: number;
95
+ isDeprecated: boolean;
96
+ name: string | null;
97
+ totalDepositsUsd: string;
98
+ totalBorrowsUsd: string;
99
+ assetCount: number;
100
+ connectedHubIds: number[];
101
+ connectedHubCount: number;
102
+ liquidationTargetHfWad: string;
103
+ liquidationBonusFactorBps: number;
104
+ markets: StellarSpokeMarket[];
105
+ }
106
+ /** Interest-rate-model curve (ray-scaled), sourced from the HubAsset doc. */
107
+ export interface StellarReserveIrmCurve {
108
+ baseRateRay: string;
109
+ slope1Ray: string;
110
+ slope2Ray: string;
111
+ slope3Ray: string;
112
+ optimalUtilizationRay: string;
113
+ midUtilizationRay: string;
114
+ maxUtilizationRay: string;
115
+ maxBorrowRateRay: string;
116
+ reserveFactorBps: number;
117
+ }
118
+ /**
119
+ * Reserve detail page: one asset, in one spoke, on one hub. Merges liquidity
120
+ * truth (HubAsset), risk truth (SpokeAsset) and the spoke's liquidation curve.
121
+ */
122
+ export interface StellarReserve {
123
+ spokeId: number;
124
+ hubId: number;
125
+ asset: string;
126
+ supplyApy: number;
127
+ borrowApy: number;
128
+ utilization: number;
129
+ suppliedShort: number;
130
+ borrowedShort: number;
131
+ availableLiquidityShort: number;
132
+ supplyCapShort: number;
133
+ borrowCapShort: number;
134
+ depositCapFilledPct: number;
135
+ borrowCapFilledPct: number;
136
+ isFlashloanable: boolean;
137
+ flashloanFeeBps: number;
138
+ collateralFactorBps: number;
139
+ liquidationThresholdBps: number;
140
+ liquidationPenaltyBps: number;
141
+ liquidationFeesBps: number;
142
+ isCollateralizable: boolean;
143
+ isBorrowable: boolean;
144
+ paused: boolean;
145
+ frozen: boolean;
146
+ useAsCollateral: boolean;
147
+ targetHealthFactorWad: string;
148
+ healthFactorForMaxBonusWad: string;
149
+ liquidationBonusFactorBps: number;
150
+ irm: StellarReserveIrmCurve;
151
+ supportedCollateral: string[];
152
+ borrowable: string[];
153
+ }
154
+ export interface StellarTopHolder {
155
+ owner: string;
156
+ accountId: string;
157
+ scaledRay: string;
158
+ amountShort: number;
159
+ sharePct: number;
160
+ }
161
+ /** Top holders of a reserve, for one side (deposits or borrows). */
162
+ export interface StellarTopHolders {
163
+ spokeId: number;
164
+ hubId: number;
165
+ asset: string;
166
+ side: StellarLendingHoldersSide;
167
+ totalScaledRay: string;
168
+ holders: StellarTopHolder[];
169
+ }
170
+ /** One account's position in one reserve. */
171
+ export interface StellarAccountPosition {
172
+ accountId: string;
173
+ owner: string;
174
+ spokeId: number;
175
+ hubId: number;
176
+ asset: string;
177
+ positionMode: number;
178
+ supplyScaledRay: string;
179
+ borrowScaledRay: string;
180
+ supplyIndexRay: string | null;
181
+ borrowIndexRay: string | null;
182
+ entryLtvBps: number;
183
+ entryLiquidationThresholdBps: number;
184
+ entryLiquidationBonusBps: number;
185
+ entryLiquidationFeesBps: number;
186
+ initialPaymentMultiplier: StellarInitialPaymentMultiplier | null;
187
+ updatedAt: number;
188
+ ledger: number;
189
+ }
190
+ /** All positions for an owner (cross-spoke/hub portfolio) or one account. */
191
+ export interface StellarAccountPositions {
192
+ positions: StellarAccountPosition[];
193
+ }
194
+ /** A timelock governance proposal on the Stellar lending governance contract. */
195
+ export interface StellarGovernanceProposal {
196
+ operationId: string;
197
+ kind: StellarGovernanceProposalKind;
198
+ status: StellarGovernanceProposalStatus;
199
+ target: StellarGovernanceProposalTarget;
200
+ targetAddress: string;
201
+ functionName: string;
202
+ summary: string;
203
+ fields: StellarGovernanceProposalField[];
204
+ assetAddress?: string;
205
+ assetSymbol?: string;
206
+ proposer: string;
207
+ scheduledLedger: number;
208
+ readyLedger: number;
209
+ delayLedgers: number;
210
+ expiresLedger: number;
211
+ executedLedger?: number;
212
+ cancelledLedger?: number;
213
+ scheduledAt: number;
214
+ executedAt?: number;
215
+ cancelledAt?: number;
216
+ scheduledTxHash: string;
217
+ executedTxHash?: string;
218
+ cancelledTxHash?: string;
219
+ }
220
+ /** Cursor-paginated page of governance proposals. */
221
+ export interface StellarGovernanceProposalsPage {
222
+ resources: StellarGovernanceProposal[];
223
+ hasMoreResults: boolean;
224
+ continuationToken: string;
225
+ }
226
+ /** One binned market-snapshot point for a graph series. */
227
+ export interface StellarMarketGraphPoint {
228
+ timestamp: string;
229
+ hubId: number;
230
+ spokeId: number | null;
231
+ token: string;
232
+ supplyApy: number;
233
+ borrowApy: number;
234
+ utilization: number;
235
+ totalDepositsUsd: number;
236
+ totalBorrowsUsd: number;
237
+ availableLiquidityUsd: number;
238
+ usdPrice: number;
239
+ }
240
+ /** One binned activity-derived fee/flash point. */
241
+ export interface StellarFeeGraphPoint {
242
+ timestamp: string;
243
+ feeShort: number;
244
+ usd: number;
245
+ }
246
+ /** A market-history graph: binned snapshot points (+ optional fee series). */
247
+ export interface StellarMarketGraph {
248
+ points: StellarMarketGraphPoint[];
249
+ fees?: StellarFeeGraphPoint[];
250
+ }
251
+ /** Time-window + bin selector shared by every graph read. */
252
+ export interface StellarMarketGraphQuery {
253
+ /** Inclusive window start (ISO-8601). */
254
+ from: string;
255
+ /** Exclusive window end (ISO-8601). */
256
+ to: string;
257
+ /** Bin width as a timespan string (e.g. `1h`, `1d`). */
258
+ bin: string;
259
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Stellar lending read surface.
3
+ *
4
+ * Hand-written typed wrappers over the api-v2 `stellar-lending` GET routes
5
+ * (this is intentionally NOT part of the swagger-generated read SDK). Each
6
+ * function takes a `XOXNOClient` plus typed params and resolves to the mirrored
7
+ * response shape from `./lending-read-types`. A `stellarLendingRead(client)`
8
+ * factory binds the client once for ergonomic call sites.
9
+ *
10
+ * HTTP plumbing (base URL, query-string assembly, error mapping, caching) is
11
+ * delegated to `XOXNOClient.fetchWithTimeout`, the same wrapper the generated
12
+ * SDK uses.
13
+ */
14
+ import type { OurRequestInit, XOXNOClient } from '../../utils/api';
15
+ import type { StellarAccountPositions, StellarAsset, StellarAssetMarket, StellarGovernanceProposalsPage, StellarHub, StellarLendingHoldersSide, StellarLendingMarketSide, StellarMarketGraph, StellarMarketGraphQuery, StellarReserve, StellarSpoke, StellarTopHolders } from './lending-read-types';
16
+ /** Reserve detail: one asset, in one spoke, on one hub. */
17
+ export declare const getStellarReserve: (client: XOXNOClient, spokeId: number, hubId: number, asset: string, init?: OurRequestInit) => Promise<StellarReserve>;
18
+ /** Top holders of a reserve, for one side (deposits or borrows). */
19
+ export declare const getStellarReserveHolders: (client: XOXNOClient, spokeId: number, hubId: number, asset: string, side: StellarLendingHoldersSide, init?: OurRequestInit) => Promise<StellarTopHolders>;
20
+ /** Asset overview: header totals + APY ranges. */
21
+ export declare const getStellarAsset: (client: XOXNOClient, asset: string, init?: OurRequestInit) => Promise<StellarAsset>;
22
+ /** Asset markets (per spoke/hub) for one side. */
23
+ export declare const getStellarAssetMarkets: (client: XOXNOClient, asset: string, side: StellarLendingMarketSide, init?: OurRequestInit) => Promise<StellarAssetMarket[]>;
24
+ /** Hub overview: totals + per-asset opportunities. */
25
+ export declare const getStellarHub: (client: XOXNOClient, hubId: number, init?: OurRequestInit) => Promise<StellarHub>;
26
+ /** Spoke overview: totals + connected hubs + per-reserve markets. */
27
+ export declare const getStellarSpoke: (client: XOXNOClient, spokeId: number, init?: OurRequestInit) => Promise<StellarSpoke>;
28
+ /** All positions for an owner (cross-partition portfolio). */
29
+ export declare const getStellarUserPositions: (client: XOXNOClient, owner: string, init?: OurRequestInit) => Promise<StellarAccountPositions>;
30
+ /** All positions for a single account (single-partition). */
31
+ export declare const getStellarAccountPositions: (client: XOXNOClient, accountId: string, init?: OurRequestInit) => Promise<StellarAccountPositions>;
32
+ /** Governance proposals (cursor-paginated). */
33
+ export declare const getStellarGovernanceProposals: (client: XOXNOClient, opts?: {
34
+ top?: number;
35
+ continuationToken?: string;
36
+ }, init?: OurRequestInit) => Promise<StellarGovernanceProposalsPage>;
37
+ /** Asset market-history graph. */
38
+ export declare const getStellarAssetGraph: (client: XOXNOClient, asset: string, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
39
+ /** Hub market-history graph. */
40
+ export declare const getStellarHubGraph: (client: XOXNOClient, hubId: number, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
41
+ /** Spoke market-history graph. */
42
+ export declare const getStellarSpokeGraph: (client: XOXNOClient, spokeId: number, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
43
+ /** Reserve market-history graph (+ fee series). */
44
+ export declare const getStellarReserveGraph: (client: XOXNOClient, spokeId: number, hubId: number, asset: string, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
45
+ /**
46
+ * Client-bound Stellar lending read namespace. Binds `client` once so call
47
+ * sites read `read.reserve(spokeId, hubId, asset)` instead of threading the
48
+ * client through every call.
49
+ */
50
+ export declare const stellarLendingRead: (client: XOXNOClient) => {
51
+ reserve: (spokeId: number, hubId: number, asset: string, init?: OurRequestInit) => Promise<StellarReserve>;
52
+ reserveHolders: (spokeId: number, hubId: number, asset: string, side: StellarLendingHoldersSide, init?: OurRequestInit) => Promise<StellarTopHolders>;
53
+ asset: (asset: string, init?: OurRequestInit) => Promise<StellarAsset>;
54
+ assetMarkets: (asset: string, side: StellarLendingMarketSide, init?: OurRequestInit) => Promise<StellarAssetMarket[]>;
55
+ hub: (hubId: number, init?: OurRequestInit) => Promise<StellarHub>;
56
+ spoke: (spokeId: number, init?: OurRequestInit) => Promise<StellarSpoke>;
57
+ userPositions: (owner: string, init?: OurRequestInit) => Promise<StellarAccountPositions>;
58
+ accountPositions: (accountId: string, init?: OurRequestInit) => Promise<StellarAccountPositions>;
59
+ governanceProposals: (opts?: {
60
+ top?: number;
61
+ continuationToken?: string;
62
+ }, init?: OurRequestInit) => Promise<StellarGovernanceProposalsPage>;
63
+ assetGraph: (asset: string, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
64
+ hubGraph: (hubId: number, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
65
+ spokeGraph: (spokeId: number, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
66
+ reserveGraph: (spokeId: number, hubId: number, asset: string, query: StellarMarketGraphQuery, init?: OurRequestInit) => Promise<StellarMarketGraph>;
67
+ };
68
+ export type StellarLendingRead = ReturnType<typeof stellarLendingRead>;
69
+ export * from './lending-read-types';
@@ -15,7 +15,6 @@
15
15
  * `rpc.Server.prepareTransaction` (simulation + Soroban footprint/auth/resource
16
16
  * fee) before handing the XDR to the wallet to sign.
17
17
  */
18
- import type { BorrowArgs, FlashLoanArgs, LiquidateArgs, MigrateFromBlendArgs, MultiplyArgs, RepayArgs, RepayDebtWithCollateralArgs, SupplyArgs, SwapCollateralArgs, SwapDebtArgs, WithdrawArgs } from '@xoxno/types';
19
18
  import { xdr } from '@stellar/stellar-sdk';
20
19
  import { type StellarNetwork } from './contracts';
21
20
  import { type StellarStrategySwapHopInput, type StellarStrategySwapInput, type StellarStrategySwapPathInput } from './scval-encode';
@@ -79,74 +78,158 @@ export type { StellarSwapVenue } from './scval-encode';
79
78
  * does this via `rpc.Server.prepareTransaction`.
80
79
  */
81
80
  export declare function buildTx(opts: StellarBuilderOptions, method: string, params: xdr.ScVal[]): BuiltStellarTx;
82
- export interface StellarTokenAmount {
83
- token: string;
81
+ /** A `(hub_id, asset)` coordinate — the `HubAssetKey` struct, builder-side. */
82
+ export interface StellarHubAsset {
83
+ hubId: number;
84
+ asset: string;
85
+ }
86
+ /** A `HubAssetKey` paired with an i128 decimal-string amount. */
87
+ export interface StellarHubAssetAmount extends StellarHubAsset {
84
88
  amount: string;
85
89
  }
90
+ export interface StellarSupplyArgs extends StellarHubAssetAmount {
91
+ /** Existing account id; omit / `0` opens a new account. */
92
+ accountNonce?: number;
93
+ /** Risk spoke the (new) account binds to; defaults to the canonical spoke 0. */
94
+ spokeId?: number;
95
+ }
86
96
  export interface StellarSupplyBatchArgs {
87
97
  accountNonce?: number;
88
- eModeCategory?: number;
89
- assets: ReadonlyArray<StellarTokenAmount>;
98
+ spokeId?: number;
99
+ assets: ReadonlyArray<StellarHubAssetAmount>;
100
+ }
101
+ export interface StellarBorrowArgs extends StellarHubAssetAmount {
102
+ accountNonce: number;
103
+ /** Optional recipient override (`C...`/`G...`); debt is recorded on the account. */
104
+ to?: string;
90
105
  }
91
106
  export interface StellarBorrowBatchArgs {
92
107
  accountNonce: number;
93
- borrows: ReadonlyArray<StellarTokenAmount>;
108
+ borrows: ReadonlyArray<StellarHubAssetAmount>;
109
+ to?: string;
94
110
  }
95
- export interface StellarWithdrawBatchArgs {
111
+ export interface StellarWithdrawArgs extends StellarHubAssetAmount {
96
112
  accountNonce: number;
97
- withdrawals: ReadonlyArray<StellarTokenAmount>;
98
113
  /**
99
114
  * Optional recipient override (`C...` or `G...`). The pool pays the
100
115
  * withdrawn tokens to this address instead of the caller. Omit for the
101
116
  * standard flow — the contract arg is still sent, encoded as
102
- * `Option::None` (ScVal void), which the controller resolves to the
103
- * caller.
117
+ * `Option::None` (ScVal void), which the controller resolves to the caller.
104
118
  */
105
119
  to?: string;
106
120
  }
121
+ export interface StellarWithdrawBatchArgs {
122
+ accountNonce: number;
123
+ withdrawals: ReadonlyArray<StellarHubAssetAmount>;
124
+ to?: string;
125
+ }
126
+ export interface StellarRepayArgs extends StellarHubAssetAmount {
127
+ accountNonce: number;
128
+ }
107
129
  export interface StellarRepayBatchArgs {
108
130
  accountNonce: number;
109
- payments: ReadonlyArray<StellarTokenAmount>;
131
+ payments: ReadonlyArray<StellarHubAssetAmount>;
132
+ }
133
+ export interface StellarLiquidateArgs {
134
+ accountNonce: number;
135
+ debtPayments: ReadonlyArray<StellarHubAssetAmount>;
136
+ }
137
+ export interface StellarFlashLoanArgs extends StellarHubAsset {
138
+ amount: string;
139
+ receiver: string;
140
+ data: string | Uint8Array;
141
+ }
142
+ export interface StellarMultiplyArgs {
143
+ accountNonce?: number;
144
+ spokeId?: number;
145
+ collateral: StellarHubAsset;
146
+ debtToFlashLoan: string;
147
+ debt: StellarHubAsset;
148
+ /** `PositionMode` repr(u32). */
149
+ mode: number;
150
+ steps: StellarSwapStepsInput;
151
+ initialPayment?: StellarHubAssetAmount;
152
+ convertSwap?: StellarSwapStepsInput;
153
+ }
154
+ export interface StellarSwapDebtArgs {
155
+ accountNonce: number;
156
+ existingDebt: StellarHubAsset;
157
+ newDebtAmount: string;
158
+ newDebt: StellarHubAsset;
159
+ steps: StellarSwapStepsInput;
160
+ }
161
+ export interface StellarSwapCollateralArgs {
162
+ accountNonce: number;
163
+ current: StellarHubAsset;
164
+ fromAmount: string;
165
+ newCollateral: StellarHubAsset;
166
+ steps: StellarSwapStepsInput;
167
+ }
168
+ export interface StellarRepayDebtWithCollateralArgs {
169
+ accountNonce: number;
170
+ collateral: StellarHubAsset;
171
+ collateralAmount: string;
172
+ debt: StellarHubAsset;
173
+ steps: StellarSwapStepsInput;
174
+ closePosition: boolean;
110
175
  }
111
176
  /**
112
- * supply(caller, account_id: u64, e_mode_category: u32, assets: Vec<(Address, i128)>)
177
+ * `migrate_from_blend` references the *Blend* pool's bare-`Address` assets, so
178
+ * collateral / supply / debt stay token-keyed; only the account's risk spoke
179
+ * (`spoke_id`) crosses on the XOXNO side.
113
180
  */
114
- export declare function buildStellarSupplyBatchTx(opts: StellarBuilderOptions, args: StellarSupplyBatchArgs): BuiltStellarTx;
181
+ export interface StellarMigrateFromBlendArgs {
182
+ accountId: number | string;
183
+ spokeId: number;
184
+ blendPool: string;
185
+ collateralTokens: ReadonlyArray<string>;
186
+ supplyTokens: ReadonlyArray<string>;
187
+ debtCaps: ReadonlyArray<{
188
+ token: string;
189
+ cap: string;
190
+ }>;
191
+ }
115
192
  /**
116
- * @xoxno/types `SupplyArgs` is a single-asset shape; the Stellar contract
117
- * expects a batch — we wrap the single asset in a 1-element Vec.
193
+ * supply(caller, account_id: u64, spoke_id: u32, assets: Vec<(HubAssetKey, i128)>)
118
194
  */
119
- export declare function buildStellarSupplyTx(opts: StellarBuilderOptions, args: SupplyArgs): BuiltStellarTx;
120
- export declare function buildStellarBorrowBatchTx(opts: StellarBuilderOptions, args: StellarBorrowBatchArgs): BuiltStellarTx;
195
+ export declare function buildStellarSupplyBatchTx(opts: StellarBuilderOptions, args: StellarSupplyBatchArgs): BuiltStellarTx;
196
+ /** Single-asset `supply` wraps the asset in a 1-element batch. */
197
+ export declare function buildStellarSupplyTx(opts: StellarBuilderOptions, args: StellarSupplyArgs): BuiltStellarTx;
121
198
  /**
122
- * borrow(caller, account_id: u64, borrows: Vec<(Address, i128)>)
199
+ * borrow(caller, account_id: u64, borrows: Vec<(HubAssetKey, i128)>,
200
+ * to: Option<Address>) — `to` is always sent; absent means the caller
201
+ * receives the funds.
123
202
  */
124
- export declare function buildStellarBorrowTx(opts: StellarBuilderOptions, args: BorrowArgs): BuiltStellarTx;
125
- export declare function buildStellarWithdrawBatchTx(opts: StellarBuilderOptions, args: StellarWithdrawBatchArgs): BuiltStellarTx;
203
+ export declare function buildStellarBorrowBatchTx(opts: StellarBuilderOptions, args: StellarBorrowBatchArgs): BuiltStellarTx;
204
+ /** Single-asset `borrow`. */
205
+ export declare function buildStellarBorrowTx(opts: StellarBuilderOptions, args: StellarBorrowArgs): BuiltStellarTx;
126
206
  /**
127
- * withdraw(caller, account_id: u64, withdrawals: Vec<(Address, i128)>,
207
+ * withdraw(caller, account_id: u64, withdrawals: Vec<(HubAssetKey, i128)>,
128
208
  * to: Option<Address>) — `to` is always sent; absent means the caller
129
209
  * receives the funds.
130
210
  */
131
- export declare function buildStellarWithdrawTx(opts: StellarBuilderOptions, args: WithdrawArgs): BuiltStellarTx;
132
- export declare function buildStellarRepayBatchTx(opts: StellarBuilderOptions, args: StellarRepayBatchArgs): BuiltStellarTx;
211
+ export declare function buildStellarWithdrawBatchTx(opts: StellarBuilderOptions, args: StellarWithdrawBatchArgs): BuiltStellarTx;
212
+ /** Single-asset `withdraw`. */
213
+ export declare function buildStellarWithdrawTx(opts: StellarBuilderOptions, args: StellarWithdrawArgs): BuiltStellarTx;
133
214
  /**
134
- * repay(caller, account_id: u64, payments: Vec<(Address, i128)>)
215
+ * repay(caller, account_id: u64, payments: Vec<(HubAssetKey, i128)>)
135
216
  */
136
- export declare function buildStellarRepayTx(opts: StellarBuilderOptions, args: RepayArgs): BuiltStellarTx;
217
+ export declare function buildStellarRepayBatchTx(opts: StellarBuilderOptions, args: StellarRepayBatchArgs): BuiltStellarTx;
218
+ /** Single-asset `repay`. */
219
+ export declare function buildStellarRepayTx(opts: StellarBuilderOptions, args: StellarRepayArgs): BuiltStellarTx;
137
220
  /**
138
- * liquidate(liquidator, account_id: u64, debt_payments: Vec<(Address, i128)>)
221
+ * liquidate(liquidator, account_id: u64, debt_payments: Vec<(HubAssetKey, i128)>)
139
222
  */
140
- export declare function buildStellarLiquidateTx(opts: StellarBuilderOptions, args: LiquidateArgs): BuiltStellarTx;
223
+ export declare function buildStellarLiquidateTx(opts: StellarBuilderOptions, args: StellarLiquidateArgs): BuiltStellarTx;
141
224
  /**
142
- * flash_loan(caller, asset, amount: i128, receiver, data: Bytes)
225
+ * flash_loan(caller, asset: HubAssetKey, amount: i128, receiver, data: Bytes)
143
226
  */
144
- export declare function buildStellarFlashLoanTx(opts: StellarBuilderOptions, args: FlashLoanArgs): BuiltStellarTx;
227
+ export declare function buildStellarFlashLoanTx(opts: StellarBuilderOptions, args: StellarFlashLoanArgs): BuiltStellarTx;
145
228
  /**
146
229
  * Build a `migrate_from_blend` controller invocation: atomically moves a Blend
147
230
  * V2 position (collateral + supply + debt) into XOXNO at zero flash-loan fee.
148
231
  *
149
- * ABI: `migrate_from_blend(caller, account_id, e_mode_category, blend_pool,
232
+ * ABI: `migrate_from_blend(caller, account_id, spoke_id, blend_pool,
150
233
  * collateral_assets, supply_assets, debt_caps: Vec<(Address, i128)>)`. Pass
151
234
  * `accountId = "0"` to open a new account. Each debt cap should slightly exceed
152
235
  * the live Blend debt — Blend refunds the excess, reconciled on-chain.
@@ -155,31 +238,31 @@ export declare function buildStellarFlashLoanTx(opts: StellarBuilderOptions, arg
155
238
  * user)` authorization is materialized by `prepareTransaction` (simulation) and
156
239
  * signed by the wallet over the whole envelope.
157
240
  */
158
- export declare function buildStellarMigrateFromBlendTx(opts: StellarBuilderOptions, args: MigrateFromBlendArgs): BuiltStellarTx;
241
+ export declare function buildStellarMigrateFromBlendTx(opts: StellarBuilderOptions, args: StellarMigrateFromBlendArgs): BuiltStellarTx;
159
242
  /**
160
- * multiply(caller, account_id, e_mode_category, collateral_token,
161
- * debt_to_flash_loan: i128, debt_token, mode: PositionMode,
162
- * swap: Bytes, initial_payment: Option<(Address, i128)>,
243
+ * multiply(caller, account_id, spoke_id, collateral: HubAssetKey,
244
+ * debt_to_flash_loan: i128, debt: HubAssetKey, mode: PositionMode,
245
+ * swap: Bytes, initial_payment: Option<(HubAssetKey, i128)>,
163
246
  * convert_swap: Option<Bytes>) -> u64
164
247
  *
165
248
  * `mode` is a repr(u32) `PositionMode` → encoded as `scvU32`. The two trailing
166
249
  * `Option`s seed an optional initial collateral payment and a secondary swap
167
250
  * converting it into the collateral token; both omit to Soroban `Void`.
168
251
  */
169
- export declare function buildStellarMultiplyTx(opts: StellarBuilderOptions, args: MultiplyArgs): BuiltStellarTx;
252
+ export declare function buildStellarMultiplyTx(opts: StellarBuilderOptions, args: StellarMultiplyArgs): BuiltStellarTx;
170
253
  /**
171
- * swap_debt(caller, account_id, existing_debt_token, new_debt_amount: i128,
172
- * new_debt_token, steps: Bytes)
254
+ * swap_debt(caller, account_id, existing_debt: HubAssetKey, amount: i128,
255
+ * new_debt: HubAssetKey, swap: Bytes)
173
256
  */
174
- export declare function buildStellarSwapDebtTx(opts: StellarBuilderOptions, args: SwapDebtArgs): BuiltStellarTx;
257
+ export declare function buildStellarSwapDebtTx(opts: StellarBuilderOptions, args: StellarSwapDebtArgs): BuiltStellarTx;
175
258
  /**
176
- * swap_collateral(caller, account_id, current_collateral, from_amount: i128,
177
- * new_collateral, steps: Bytes)
259
+ * swap_collateral(caller, account_id, current: HubAssetKey, amount: i128,
260
+ * new: HubAssetKey, swap: Bytes)
178
261
  */
179
- export declare function buildStellarSwapCollateralTx(opts: StellarBuilderOptions, args: SwapCollateralArgs): BuiltStellarTx;
262
+ export declare function buildStellarSwapCollateralTx(opts: StellarBuilderOptions, args: StellarSwapCollateralArgs): BuiltStellarTx;
180
263
  /**
181
- * repay_debt_with_collateral(caller, account_id, collateral_token,
182
- * collateral_amount: i128, debt_token,
183
- * steps: Bytes, close_position: bool)
264
+ * repay_debt_with_collateral(caller, account_id, collateral: HubAssetKey,
265
+ * collateral_amount: i128, debt: HubAssetKey,
266
+ * swap: Bytes, close_position: bool)
184
267
  */
185
- export declare function buildStellarRepayDebtWithCollateralTx(opts: StellarBuilderOptions, args: RepayDebtWithCollateralArgs): BuiltStellarTx;
268
+ export declare function buildStellarRepayDebtWithCollateralTx(opts: StellarBuilderOptions, args: StellarRepayDebtWithCollateralArgs): BuiltStellarTx;
@@ -73,6 +73,26 @@ export declare const tupleAddrAmountVec: (entries: Array<{
73
73
  token: string;
74
74
  amount: string;
75
75
  }>) => xdr.ScVal;
76
+ /**
77
+ * Encode a `HubAssetKey` `#[contracttype]` struct — the `(hub_id, asset)`
78
+ * coordinate that keys liquidity and positions on the multi-hub controller.
79
+ * Emitted as an ScVal map with symbol keys in lexicographic order
80
+ * (`asset`, then `hub_id`).
81
+ */
82
+ export declare const hubAsset: (hubId: number, asset: string) => xdr.ScVal;
83
+ /**
84
+ * Encode a single Soroban tuple `(HubAssetKey, i128)` as a 2-element `scvVec`.
85
+ */
86
+ export declare const tupleHubAssetAmount: (hubId: number, asset: string, amount: string) => xdr.ScVal;
87
+ /**
88
+ * Encode `Vec<(HubAssetKey, i128)>` — the multi-hub batch payload carried by
89
+ * `supply` / `borrow` / `withdraw` / `repay` / `liquidate`.
90
+ */
91
+ export declare const tupleHubAssetAmountVec: (entries: Array<{
92
+ hubId: number;
93
+ asset: string;
94
+ amount: string;
95
+ }>) => xdr.ScVal;
76
96
  /**
77
97
  * Encode a Soroban `struct` — at the XDR level, structs are maps with
78
98
  * `Symbol` keys in **lexicographic order** of field names.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "1.0.159",
3
+ "version": "1.0.161",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,6 +13,16 @@
13
13
  "types": "./dist/cjs/index.d.ts",
14
14
  "default": "./dist/index.cjs"
15
15
  }
16
+ },
17
+ "./stellar-lending": {
18
+ "import": {
19
+ "types": "./dist/sdk/stellar/index.d.ts",
20
+ "default": "./dist/sdk/stellar/index.esm.js"
21
+ },
22
+ "require": {
23
+ "types": "./dist/cjs/sdk/stellar/index.d.ts",
24
+ "default": "./dist/sdk/stellar/index.cjs"
25
+ }
16
26
  }
17
27
  },
18
28
  "types": "./dist/index.d.ts",
@@ -104,7 +114,7 @@
104
114
  "dependencies": {
105
115
  "@multiversx/sdk-core": "^15.3.2",
106
116
  "@multiversx/sdk-network-providers": "^2.9.3",
107
- "@xoxno/types": "^1.0.426"
117
+ "@xoxno/types": "^1.0.428"
108
118
  },
109
119
  "peerDependencies": {
110
120
  "@stellar/stellar-sdk": ">=15.0.0 <17.0.0"