@sodax/types 2.2.0-rc.2 → 2.2.0-rc.4

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.
@@ -495,6 +495,13 @@ export interface SubmitTxStatusQueryV2 {
495
495
  }
496
496
  /** Lifecycle status of a submitted swap tx. */
497
497
  export type SubmitSwapTxStatusV2 = 'pending' | 'relaying' | 'relayed' | 'posting_execution' | 'posted_execution' | 'solved' | 'failed';
498
+ /**
499
+ * Product/operation discriminator on a submit-tx status row. `'swap'` for an ordinary swap;
500
+ * `'leverage_deposit'` / `'leverage_withdraw'` for a leverage-yield vault op queued via
501
+ * `POST /leverage-yield/submit-tx` (the backend maps that body's `operation: 'deposit' | 'withdraw'`
502
+ * onto these row-level values).
503
+ */
504
+ export type SubmitTxOperationV2 = 'swap' | 'leverage_deposit' | 'leverage_withdraw';
498
505
  /** Lifecycle status of a cross-chain relay packet. */
499
506
  export type PacketDataStatusV2 = 'pending' | 'validating' | 'executing' | 'executed';
500
507
  /** Relay packet data attached to a submit-tx processing result (snake_case as stored). */
@@ -528,6 +535,11 @@ export interface SubmitTxStatusResultV2 {
528
535
  packetData?: PacketDataV2;
529
536
  /** Intent hash from the solver API (populated after post-execution). */
530
537
  intent_hash?: string;
538
+ /**
539
+ * Solver destination-chain fill tx hash. Set on solver-confirmed fills; MAY be absent even when
540
+ * `status === 'solved'` if the fill was confirmed via the on-chain journal instead.
541
+ */
542
+ fillTxHash?: string;
531
543
  }
532
544
  /** Processing state of a submitted swap tx. */
533
545
  export interface SubmitTxStatusDataV2 {
@@ -537,6 +549,8 @@ export interface SubmitTxStatusDataV2 {
537
549
  srcChainKey: string;
538
550
  /** Current processing status. */
539
551
  status: SubmitSwapTxStatusV2;
552
+ /** Product/operation discriminator. Absent from backends predating the field — treat as `'swap'`. */
553
+ operation?: SubmitTxOperationV2;
540
554
  /** Step where processing failed. */
541
555
  failedAtStep?: SubmitSwapTxStatusV2;
542
556
  /** Failure reason. */
@@ -545,6 +559,8 @@ export interface SubmitTxStatusDataV2 {
545
559
  processingAttempts: number;
546
560
  /** ISO 8601 timestamp set when the swap exhausted its processing budget and was abandoned. */
547
561
  abandonedAt?: string;
562
+ /** ISO 8601 timestamp set when an expired, abandoned swap was relayed for refund; the row stays abandoned. */
563
+ relayedForRefundAt?: string;
548
564
  /** Processing result (present when solved). */
549
565
  result?: SubmitTxStatusResultV2;
550
566
  /** User-facing hint when status is failed or the swap was abandoned. */
@@ -1,4 +1,5 @@
1
1
  export * from './backendApiV1.js';
2
2
  export * from './backendApiV2.js';
3
+ export * from './leverageYieldApiV2.js';
3
4
  export * from './sponsoringApi.js';
4
5
  export * from './backendBridgeApiV2.js';
@@ -1,4 +1,5 @@
1
1
  export * from './backendApiV1.js';
2
2
  export * from './backendApiV2.js';
3
+ export * from './leverageYieldApiV2.js';
3
4
  export * from './sponsoringApi.js';
4
5
  export * from './backendBridgeApiV2.js';
@@ -0,0 +1,350 @@
1
+ import type { AllowanceCheckResponseV2, ApproveResponseV2, CancelIntentRequestV2, CancelIntentResponseV2, CreateIntentResponseV2, DeadlineQueryV2, DeadlineResponseV2, FeeQueryV2, FeeResponseV2, GasEstimateRequestV2, GasEstimateResponseV2, GetIntentResponseV2, IntentExtraDataRequestV2, IntentExtraDataResponseV2, IntentHashRequestV2, IntentHashResponseV2, IntentPacketRequestV2, IntentPacketResponseV2, IntentStateV2, PartnerFeeV2, QuoteQueryV2, QuoteResponseV2, QuoteTypeV2, StatusRequestV2, StatusResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusQueryV2, SubmitTxStatusResponseV2 } from './backendApiV2.js';
2
+ /**
3
+ * JSON-safe mirror of the SDK `LeverageYieldLsdSource` — the off-chain LSD staking-APR source
4
+ * on a vault descriptor. Plain primitives (no branded addresses), matching the swaps-domain
5
+ * `SwapTokenV2` projection style rather than reusing the branded config type.
6
+ */
7
+ export interface LsdSourceV2 {
8
+ /** DefiLlama pool ID (UUID) for the LSD's staking pool. */
9
+ poolId: string;
10
+ /** Hardcoded APR (percentage, e.g. `3.2` for 3.2%) used when the DefiLlama fetch errors. */
11
+ fallbackAprPct: number;
12
+ /** Human label for UI display, e.g. `'Lido (stETH)'`. */
13
+ label: string;
14
+ }
15
+ /**
16
+ * A deployed leverage-yield vault descriptor (`LeverageYieldVault` projected to JSON primitives —
17
+ * addresses as plain `string`, mirroring {@link LsdSourceV2}). Static descriptor for vault
18
+ * discovery and UI display.
19
+ */
20
+ export interface LeverageVaultV2 {
21
+ /** Stable lookup key — the leverage-vault share-token symbol (e.g. `lsodaWEETH`). */
22
+ name: string;
23
+ /** Deployed `LeverageYieldVault` proxy address on the Sonic hub. */
24
+ vault: string;
25
+ /** The vault's underlying asset on the hub (a Sodax vault-token wrapper, e.g. sodaWEETH). */
26
+ asset: string;
27
+ /** The token the vault borrows against `asset` collateral (a Sodax vault-token wrapper, e.g. sodaETH). */
28
+ borrowToken: string;
29
+ /** LSD staking-APR source for the underlying asset; omitted for non-LSD vaults. */
30
+ lsdSource?: LsdSourceV2;
31
+ }
32
+ /** GET /leverage-yield/vaults — the registry of deployed leverage-yield vaults. */
33
+ export type GetLeverageVaultsResponseV2 = readonly LeverageVaultV2[];
34
+ /** GET /leverage-yield/vaults/:name — a single vault descriptor by its lsoda* share-token name. */
35
+ export type GetLeverageVaultResponseV2 = LeverageVaultV2;
36
+ /** Query identifying a single vault by its hub proxy address. Used by the read endpoints below. */
37
+ export interface VaultQueryV2 {
38
+ /** Hub-side `LeverageYieldVault` proxy address (its address doubles as the lsoda* token). */
39
+ vault: string;
40
+ }
41
+ /** Query identifying a vault plus an owner address. Used by share-balance / max-withdraw. */
42
+ export interface VaultOwnerQueryV2 extends VaultQueryV2 {
43
+ /** Owner (hub wallet) address whose vault shares are inspected. */
44
+ owner: string;
45
+ }
46
+ /** Query identifying a vault plus an `assets` amount (vault-asset units, decimal string). */
47
+ export interface VaultAssetsQueryV2 extends VaultQueryV2 {
48
+ /** Amount of the vault's underlying asset in smallest unit (18 decimals, decimal string). */
49
+ assets: string;
50
+ }
51
+ /** Query identifying a vault plus a `shares` amount (lsoda* units, decimal string). */
52
+ export interface VaultSharesQueryV2 extends VaultQueryV2 {
53
+ /** Amount of vault shares (lsoda*) in smallest unit (18 decimals, decimal string). */
54
+ shares: string;
55
+ }
56
+ /** GET /leverage-yield/asset — the vault's underlying hub asset (Sodax vault-token wrapper). */
57
+ export interface VaultAssetResponseV2 {
58
+ /** Underlying asset address on the hub (e.g. sodaWEETH). */
59
+ asset: string;
60
+ }
61
+ /**
62
+ * GET /leverage-yield/position — leveraged-position snapshot. JSON-safe mirror of the SDK
63
+ * `LeverageYieldPosition`; every bigint field is a decimal `string`.
64
+ */
65
+ export interface LeverageYieldPositionV2 {
66
+ /** Collateral supplied to the AAVE pool, in vault-asset units (18 decimals, decimal string). */
67
+ collateral: string;
68
+ /** Variable debt borrowed against the collateral, in vault-asset units (18 decimals, decimal string). */
69
+ debt: string;
70
+ /** Current loan-to-value in basis points (out of `10000`; e.g. `"8500"` = 85%). */
71
+ ltv: string;
72
+ /** AAVE health factor in WAD (1e18); below `"1000000000000000000"` implies liquidation risk (decimal string). */
73
+ healthFactor: string;
74
+ /** Asset held by the vault but not yet supplied to the pool, in vault-asset units (18 decimals, decimal string). */
75
+ idleAsset: string;
76
+ }
77
+ /**
78
+ * GET /leverage-yield/apr — AAVE-only steady-state APR. JSON-safe mirror of the SDK
79
+ * `LeverageYieldApr`; every rate is in RAY (1e27 = 100%) as a decimal `string`.
80
+ */
81
+ export interface LeverageYieldAprV2 {
82
+ /** AAVE supply rate of the vault's `asset`, in RAY (decimal string). */
83
+ supplyAprRay: string;
84
+ /** AAVE variable borrow rate of the vault's `borrowToken`, in RAY (decimal string). */
85
+ borrowAprRay: string;
86
+ /** Target LTV in basis points, as read from `vault.targetLTV()` (decimal string). */
87
+ targetLtvBps: string;
88
+ /** Leverage multiplier ×1e18 (divide by 1e18 for the decimal form; decimal string). */
89
+ leverageMultiplierWad: string;
90
+ /** Net APR earned by a depositor at `targetLtvBps`, in RAY. Can be negative (decimal string). */
91
+ netAprRay: string;
92
+ }
93
+ /**
94
+ * GET /leverage-yield/apr/lsd — off-chain LSD staking-APR snapshot. JSON-safe mirror of the
95
+ * SDK `LeverageYieldLsdApr` (`aprRay` bigint → decimal string).
96
+ */
97
+ export interface LeverageYieldLsdAprV2 {
98
+ /** LSD staking APR in RAY (1e27 = 100%). `"0"` when the vault has no configured LSD source (decimal string). */
99
+ aprRay: string;
100
+ /** Human-readable provider label, e.g. `'Lido (stETH)'` (suffixed with `(fallback)` on error). */
101
+ label: string;
102
+ /** `true` when the value came from the hardcoded fallback rather than a live fetch — UIs should mark it an estimate. */
103
+ stale: boolean;
104
+ }
105
+ /**
106
+ * GET /leverage-yield/apr/effective — combined AAVE + LSD APR view. JSON-safe mirror of the
107
+ * SDK `LeverageYieldEffectiveApr`: extends {@link LeverageYieldAprV2} with the LSD staking
108
+ * yield folded into the supply side. `effectiveNetAprRay` is the honest headline number.
109
+ */
110
+ export interface LeverageYieldEffectiveAprV2 extends LeverageYieldAprV2 {
111
+ /** LSD staking APR snapshot used to compute the effective rates. */
112
+ lsdApr: LeverageYieldLsdAprV2;
113
+ /** `supplyAprRay + lsdApr.aprRay`, in RAY — the yield the supply side actually earns (decimal string). */
114
+ effectiveSupplyAprRay: string;
115
+ /** `effectiveSupplyAprRay + leverage × (effectiveSupplyAprRay − borrowAprRay)`, in RAY. The headline number (decimal string). */
116
+ effectiveNetAprRay: string;
117
+ }
118
+ /** GET /leverage-yield/total-assets — total assets managed by the vault. */
119
+ export interface VaultTotalAssetsResponseV2 {
120
+ /** Total vault assets in smallest unit (18 decimals, decimal string). */
121
+ totalAssets: string;
122
+ }
123
+ /** GET /leverage-yield/preview/deposit — shares minted for a given `assets` deposit (ERC-4626 `previewDeposit`). */
124
+ export interface PreviewDepositResponseV2 {
125
+ /** Vault shares (lsoda*) that would be minted, in smallest unit (18 decimals, decimal string). */
126
+ shares: string;
127
+ }
128
+ /** GET /leverage-yield/preview/withdraw — shares burned to withdraw a given `assets` amount (ERC-4626 `previewWithdraw`). */
129
+ export interface PreviewWithdrawResponseV2 {
130
+ /** Vault shares (lsoda*) that would be burned, in smallest unit (18 decimals, decimal string). */
131
+ shares: string;
132
+ }
133
+ /** GET /leverage-yield/preview/redeem — assets returned for redeeming a given `shares` amount (ERC-4626 `previewRedeem`). */
134
+ export interface PreviewRedeemResponseV2 {
135
+ /** Underlying asset returned, in smallest unit (18 decimals, decimal string). */
136
+ assets: string;
137
+ }
138
+ /** GET /leverage-yield/share-balance — an owner's vault share (lsoda*) balance. */
139
+ export interface ShareBalanceResponseV2 {
140
+ /** Vault shares (lsoda*) held by the owner, in smallest unit (18 decimals, decimal string). */
141
+ balance: string;
142
+ }
143
+ /**
144
+ * GET /leverage-yield/max-withdraw — an owner's RAW ERC-4626 `maxWithdraw`, NOT dust-trimmed. Fed straight
145
+ * into an asset-denominated withdraw it can trip the vault's share round-up and revert, so a "MAX" flow
146
+ * should apply its own margin (the SDK-local `getMaxWithdrawForUser` subtracts `MAX_WITHDRAW_DUST_BUFFER`
147
+ * for exactly that reason).
148
+ */
149
+ export interface MaxWithdrawResponseV2 {
150
+ /** Maximum withdrawable underlying asset, in smallest unit (18 decimals, decimal string). Raw, no dust margin. */
151
+ maxWithdraw: string;
152
+ }
153
+ /**
154
+ * POST /leverage-yield/quote/deposit — request body. Quotes a swap-style deposit: any
155
+ * solver-supported `tokenSrc` on `tokenSrcChainKey` → the vault's lsoda* share token,
156
+ * returning the expected shares in {@link QuoteResponseV2.quotedAmount}.
157
+ */
158
+ export interface LeverageYieldDepositQuoteRequestV2 {
159
+ /** Hub-side `LeverageYieldVault` proxy address (target vault). */
160
+ vault: string;
161
+ /** Source token address the user pays in, on the source spoke chain. */
162
+ tokenSrc: string;
163
+ /** Source spoke chain key (SODAX SpokeChainKey). */
164
+ tokenSrcChainKey: string;
165
+ /** Input amount in smallest unit of the source token (decimal string). */
166
+ amount: string;
167
+ /** Quote type (only `exact_input` is supported). */
168
+ quoteType: QuoteTypeV2;
169
+ /** Per-request partner-fee override; defaults to the backend's configured leverage-yield fee. */
170
+ partnerFee?: PartnerFeeV2;
171
+ /** Source address — required only when `includeTxData=true`; ignored otherwise. */
172
+ srcAddress?: string;
173
+ }
174
+ /**
175
+ * POST /leverage-yield/quote/withdraw — request body. Quotes a swap-style withdraw: the
176
+ * vault's lsoda* shares → any solver-supported `tokenDst` on `tokenDstChainKey`, returning
177
+ * the expected output in {@link QuoteResponseV2.quotedAmount}.
178
+ *
179
+ * Deliberately carries no `partnerFee`, unlike the deposit quote: the backend applies its configured
180
+ * leverage-yield fee to withdraws (deducted from the lsoda* input) and rejects unknown body fields, so
181
+ * a per-request override is not part of the wire contract.
182
+ */
183
+ export interface LeverageYieldWithdrawQuoteRequestV2 {
184
+ /** Hub-side `LeverageYieldVault` proxy address (source vault). */
185
+ vault: string;
186
+ /** Spoke chain the user signs the withdraw from — drives hub-wallet derivation and the `includeTxData` tx shape (SODAX SpokeChainKey). */
187
+ srcChainKey: string;
188
+ /** Destination token address the user receives, on the destination spoke chain. */
189
+ tokenDst: string;
190
+ /** Destination spoke chain key (SODAX SpokeChainKey). */
191
+ tokenDstChainKey: string;
192
+ /** Amount of vault shares (lsoda*) to withdraw, in smallest unit (18 decimals, decimal string). */
193
+ amount: string;
194
+ /** Quote type (only `exact_input` is supported). */
195
+ quoteType: QuoteTypeV2;
196
+ /** Source address — required only when `includeTxData=true`; ignored otherwise. */
197
+ srcAddress?: string;
198
+ /** Recipient address on `tokenDstChainKey` — required only when `includeTxData=true`; ignored otherwise. */
199
+ dstAddress?: string;
200
+ }
201
+ /**
202
+ * Shared request body for `/leverage-yield/allowance/check`, `/leverage-yield/approve`, and
203
+ * `/leverage-yield/intents/deposit`. Builds a swap-style deposit: any solver-supported
204
+ * `inputToken` on `srcChainKey` → the vault's lsoda* share token, delivered to the user's
205
+ * hub wallet on Sonic. JSON-safe mirror of the SDK `LeverageYieldSwapDepositParams`.
206
+ */
207
+ export interface CreateDepositIntentParamsV2 {
208
+ /** Hub-side `LeverageYieldVault` proxy address (its address doubles as the lsoda* token). */
209
+ vault: string;
210
+ /** Source spoke chain the user holds `inputToken` on and signs from (SODAX SpokeChainKey). */
211
+ srcChainKey: string;
212
+ /** User's address on `srcChainKey` (chain-specific format). */
213
+ srcAddress: string;
214
+ /** Spoke-side token the user pays in. */
215
+ inputToken: string;
216
+ /** Amount of `inputToken` to swap, in smallest unit of the input token (decimal string). */
217
+ inputAmount: string;
218
+ /** Minimum acceptable lsoda* output in smallest unit (18 decimals, decimal string). Slippage already applied. */
219
+ minOutputAmount: string;
220
+ /** Unix timestamp (seconds) at which the intent expires; `"0"` for no expiry. Defaults to hub block time + 5 min (decimal string). */
221
+ deadline?: string;
222
+ /** Solver address (EVM hub address). Defaults to the zero address for "any solver". */
223
+ solver?: string;
224
+ /** Per-intent partner-fee override; defaults to the effective leverage-yield/swap fee. */
225
+ partnerFee?: PartnerFeeV2;
226
+ }
227
+ /**
228
+ * POST /leverage-yield/intents/withdraw — request body. Builds a swap-style withdraw: the
229
+ * vault's lsoda* shares (held in the user's hub wallet) → any solver-supported `outputToken`
230
+ * on `dstChainKey`. The backend sets `hubWalletSwap` internally so the swap spends the lsoda*
231
+ * held in the user's hub wallet. JSON-safe mirror of the SDK `LeverageYieldSwapWithdrawParams`
232
+ * minus its `partnerFee`: the backend applies its configured leverage-yield fee to withdraws
233
+ * (deducted from the lsoda* input) and rejects unknown body fields, so there is no per-intent
234
+ * override on the wire.
235
+ */
236
+ export interface CreateWithdrawIntentParamsV2 {
237
+ /** Hub-side `LeverageYieldVault` proxy address (its address doubles as the lsoda* token). */
238
+ vault: string;
239
+ /** Spoke chain the user signs the withdraw from — drives hub-wallet derivation (SODAX SpokeChainKey). */
240
+ srcChainKey: string;
241
+ /** User's address on `srcChainKey` (chain-specific format). */
242
+ srcAddress: string;
243
+ /** Destination spoke chain where the solver delivers the swapped-back token (SODAX SpokeChainKey). */
244
+ dstChainKey: string;
245
+ /** Output spoke-side token address on `dstChainKey`. */
246
+ outputToken: string;
247
+ /** Amount of lsoda* shares to swap, in smallest unit (18 decimals, decimal string). */
248
+ inputAmount: string;
249
+ /** Minimum acceptable output in smallest unit of the output token (decimal string). Slippage already applied. */
250
+ minOutputAmount: string;
251
+ /** Recipient on `dstChainKey` (chain-specific format). Defaults to `srcAddress`. */
252
+ recipient?: string;
253
+ /** Unix timestamp (seconds) at which the intent expires; `"0"` for no expiry. Defaults to hub block time + 5 min (decimal string). */
254
+ deadline?: string;
255
+ /** Solver address (EVM hub address). Defaults to the zero address for "any solver". */
256
+ solver?: string;
257
+ }
258
+ /**
259
+ * Client-side surface for the backend Leverage Yield API v2 — for typed HTTP clients
260
+ * (fetch wrappers / SDK adapters). Each method describes one endpoint as the client sees
261
+ * it: all methods are async and all field types are the post-serialization wire shapes above
262
+ * (bigint → decimal `string`).
263
+ *
264
+ * The intent-lifecycle, gas, fee, and submit-tx methods reuse the swaps wire types verbatim
265
+ * because a leverage-yield deposit/withdraw IS an intent-based swap (see the file header). The
266
+ * leverage-yield-specific surface is the vault registry, the vault reads, and the separate
267
+ * deposit/withdraw create-intent (and quote) endpoints.
268
+ *
269
+ * As with `ISwapsApiV2`, the backend `LeverageYieldController` `implements` this — declaring every
270
+ * handler `async` and typed with the wire-shaped DTOs — so a request or response shape cannot drift
271
+ * from this contract without failing the backend build.
272
+ */
273
+ export interface ILeverageYieldApiV2 {
274
+ /** GET /leverage-yield/vaults */
275
+ getVaults(): Promise<GetLeverageVaultsResponseV2>;
276
+ /** GET /leverage-yield/vaults/:name */
277
+ getVault(name: string): Promise<GetLeverageVaultResponseV2>;
278
+ /** GET /leverage-yield/asset */
279
+ getAsset(query: VaultQueryV2): Promise<VaultAssetResponseV2>;
280
+ /** GET /leverage-yield/position */
281
+ getPosition(query: VaultQueryV2): Promise<LeverageYieldPositionV2>;
282
+ /** GET /leverage-yield/apr */
283
+ getApr(query: VaultQueryV2): Promise<LeverageYieldAprV2>;
284
+ /** GET /leverage-yield/apr/effective */
285
+ getEffectiveApr(query: VaultQueryV2): Promise<LeverageYieldEffectiveAprV2>;
286
+ /** GET /leverage-yield/apr/lsd */
287
+ getLsdApr(query: VaultQueryV2): Promise<LeverageYieldLsdAprV2>;
288
+ /** GET /leverage-yield/total-assets */
289
+ getTotalAssets(query: VaultQueryV2): Promise<VaultTotalAssetsResponseV2>;
290
+ /** GET /leverage-yield/preview/deposit */
291
+ previewDeposit(query: VaultAssetsQueryV2): Promise<PreviewDepositResponseV2>;
292
+ /** GET /leverage-yield/preview/withdraw */
293
+ previewWithdraw(query: VaultAssetsQueryV2): Promise<PreviewWithdrawResponseV2>;
294
+ /** GET /leverage-yield/preview/redeem */
295
+ previewRedeem(query: VaultSharesQueryV2): Promise<PreviewRedeemResponseV2>;
296
+ /** GET /leverage-yield/share-balance */
297
+ getShareBalance(query: VaultOwnerQueryV2): Promise<ShareBalanceResponseV2>;
298
+ /** GET /leverage-yield/max-withdraw */
299
+ getMaxWithdraw(query: VaultOwnerQueryV2): Promise<MaxWithdrawResponseV2>;
300
+ /** POST /leverage-yield/quote/deposit */
301
+ getDepositQuote(body: LeverageYieldDepositQuoteRequestV2, query?: QuoteQueryV2): Promise<QuoteResponseV2>;
302
+ /** POST /leverage-yield/quote/withdraw */
303
+ getWithdrawQuote(body: LeverageYieldWithdrawQuoteRequestV2, query?: QuoteQueryV2): Promise<QuoteResponseV2>;
304
+ /** GET /leverage-yield/deadline */
305
+ getDeadline(query?: DeadlineQueryV2): Promise<DeadlineResponseV2>;
306
+ /** POST /leverage-yield/allowance/check */
307
+ checkAllowance(body: CreateDepositIntentParamsV2): Promise<AllowanceCheckResponseV2>;
308
+ /** POST /leverage-yield/approve */
309
+ approve(body: CreateDepositIntentParamsV2): Promise<ApproveResponseV2>;
310
+ /** POST /leverage-yield/intents/deposit */
311
+ createDepositIntent(body: CreateDepositIntentParamsV2): Promise<CreateIntentResponseV2>;
312
+ /** POST /leverage-yield/intents/withdraw */
313
+ createWithdrawIntent(body: CreateWithdrawIntentParamsV2): Promise<CreateIntentResponseV2>;
314
+ /** POST /leverage-yield/intents/submit */
315
+ submitIntent(body: SubmitIntentRequestV2): Promise<SubmitIntentResponseV2>;
316
+ /** POST /leverage-yield/intents/status */
317
+ getStatus(body: StatusRequestV2): Promise<StatusResponseV2>;
318
+ /** POST /leverage-yield/intents/cancel */
319
+ cancelIntent(body: CancelIntentRequestV2): Promise<CancelIntentResponseV2>;
320
+ /** POST /leverage-yield/intents/hash */
321
+ getIntentHash(body: IntentHashRequestV2): Promise<IntentHashResponseV2>;
322
+ /** POST /leverage-yield/intents/packet */
323
+ getSolvedIntentPacket(body: IntentPacketRequestV2): Promise<IntentPacketResponseV2>;
324
+ /** POST /leverage-yield/intents/extra-data */
325
+ getIntentSubmitTxExtraData(body: IntentExtraDataRequestV2): Promise<IntentExtraDataResponseV2>;
326
+ /** GET /leverage-yield/intents/:txHash/fill */
327
+ getFilledIntent(txHash: string): Promise<IntentStateV2>;
328
+ /** GET /leverage-yield/intents/:txHash */
329
+ getIntent(txHash: string): Promise<GetIntentResponseV2>;
330
+ /** POST /leverage-yield/gas/estimate */
331
+ estimateGas(body: GasEstimateRequestV2): Promise<GasEstimateResponseV2>;
332
+ /** GET /leverage-yield/fees/partner */
333
+ getPartnerFee(query: FeeQueryV2): Promise<FeeResponseV2>;
334
+ /** GET /leverage-yield/fees/solver */
335
+ getSolverFee(query: FeeQueryV2): Promise<FeeResponseV2>;
336
+ /** POST /leverage-yield/submit-tx */
337
+ submitTx(body: LeverageYieldSubmitTxRequestV2): Promise<SubmitTxResponseV2>;
338
+ /** GET /leverage-yield/submit-tx/status */
339
+ getSubmitTxStatus(query: SubmitTxStatusQueryV2): Promise<SubmitTxStatusResponseV2>;
340
+ }
341
+ /** Which vault operation a leverage-yield submit-tx represents. */
342
+ export type LeverageYieldSubmitTxOperation = 'deposit' | 'withdraw';
343
+ /**
344
+ * Leverage-yield submit-tx request body. Extends the shared swaps {@link SubmitTxRequestV2} with the
345
+ * required `operation` discriminator the backend needs to record the queued row as a vault
346
+ * `deposit`/`withdraw` (mapped server-side to the row-level `leverage_deposit`/`leverage_withdraw`).
347
+ */
348
+ export interface LeverageYieldSubmitTxRequestV2 extends SubmitTxRequestV2 {
349
+ operation: LeverageYieldSubmitTxOperation;
350
+ }
@@ -0,0 +1,24 @@
1
+ // Backend Leverage Yield API v2 — request/response contract types.
2
+ //
3
+ // One type per request/response of every endpoint of the backend
4
+ // `leverage-yield-api` controller. This is the leverage-yield counterpart to the
5
+ // Swaps API v2 contract in `./backendApiV2.ts`, and follows the same conventions:
6
+ // - Outbound (response) types are pure JSON — every bigint-derived value (amounts,
7
+ // deadlines, APR rays, share balances, position figures) is a decimal `string`,
8
+ // because JSON cannot represent `bigint` (the one typed exception is the unsigned
9
+ // `tx` on the create-intent/approve responses, reused from the swaps contract).
10
+ // - Inbound (request) types mirror the server's parsed DTOs: the Intent struct
11
+ // (`IntentRequestV2`) carries `bigint`; the other request numeric fields
12
+ // (amounts/deadlines) are decimal `string`.
13
+ // - `Hex` / `Address` / `Hash` / `SpokeChainKey` are plain `string` everywhere.
14
+ //
15
+ // Leverage-yield deposits and withdrawals ARE intent-based swaps (the vault's lsoda*
16
+ // share token is treated as a solver-tradeable token — see `LeverageYieldService`),
17
+ // so the entire intent-relay lifecycle — the Intent struct, relay extra-data,
18
+ // submit-tx, status, cancel, hash, packet, gas estimate, and fee shapes — is
19
+ // IDENTICAL to the swaps contract. Rather than re-declare those wire shapes and risk
20
+ // drift, this file REUSES them from `./backendApiV2.ts` and defines ONLY the
21
+ // leverage-yield-specific pieces: the vault registry/read shapes and the
22
+ // deposit/withdraw create-intent (and quote) bodies. This mirrors how the Config API
23
+ // v2 section reuses the canonical config types instead of re-declaring a parallel tree.
24
+ export {};