@switch-win/sdk 1.2.2 → 1.2.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.
package/src/types.ts CHANGED
@@ -25,9 +25,10 @@ export interface BestPathResponse {
25
25
  receiver?: string;
26
26
  /** Total input amount in wei */
27
27
  totalAmountIn: string;
28
- /**
29
- * Raw DEX output in wei -- reflects price impact only.
30
- * This is the amount the pools would return before any taxes, fees, or slippage are applied.
28
+ /**
29
+ * Quoted route output in wei before the Switch protocol fee and slippage.
30
+ * Adapter-native quotes may already include token-tax effects (for example,
31
+ * the Flap Portal quote).
31
32
  */
32
33
  totalAmountOut: string;
33
34
  /**
@@ -39,18 +40,17 @@ export interface BestPathResponse {
39
40
  * multipliers to `totalAmountOut`.
40
41
  */
41
42
  expectedOutputAmount: string;
42
- /**
43
- * Minimum acceptable output after taxes, fee, and slippage.
44
- *
45
- * Calculated as:
46
- * `totalAmountOut -- (1 -- sellTax) -- (1 -- fee) -- (1 -- buyTax) -- (1 -- slippage)`
47
- *
48
- * This is the value encoded in the `tx` calldata as `_minTotalAmountOut`.
43
+ /**
44
+ * Minimum acceptable output after taxes, fee, and slippage.
45
+ *
46
+ * Tax accounting is adapter-specific. Use this API value directly rather
47
+ * than recomputing it from the reported tax rates. This is encoded in the
48
+ * `tx` calldata as `_minTotalAmountOut`.
49
49
  */
50
50
  minAmountOut: string;
51
51
  /** Human-readable path descriptions */
52
52
  paths: SwapPath[];
53
- /** Structured route breakdown (matches on-chain structs) */
53
+ /** Human-readable structured route breakdown for display and analytics. */
54
54
  routeAllocation?: RouteAllocationPlan;
55
55
  /** Ready-to-send transaction with fee on **input** (default). Only present when `sender` query param is provided. */
56
56
  tx?: SwapTransaction;
@@ -159,7 +159,7 @@ export interface SwapPathLeg {
159
159
  percentage?: number;
160
160
  }
161
161
 
162
- // -- Route allocation (matches on-chain structs) --
162
+ // -- Human-readable route allocation --
163
163
 
164
164
  /** Top-level route allocation plan */
165
165
  export interface RouteAllocationPlan {
@@ -192,14 +192,16 @@ export interface HopAllocationPlan {
192
192
  }
193
193
 
194
194
  /** A single adapter leg within a hop */
195
- export interface HopAdapterAllocationPlan {
196
- /** DEX adapter contract address */
197
- adapter: string;
195
+ export interface HopAdapterAllocationPlan {
196
+ /** Human-readable DEX adapter name */
197
+ adapter: string;
198
198
  /** Input amount routed through this adapter (wei) */
199
199
  amountIn: string;
200
- /** Expected output from this adapter (wei) */
201
- amountOut: string;
202
- }
200
+ /** Expected output from this adapter (wei) */
201
+ amountOut: string;
202
+ /** V3 fee tier or concentrated-liquidity tick-spacing hint. Zero for adapters that do not use it. */
203
+ fee?: number;
204
+ }
203
205
 
204
206
  // -- Error response --
205
207
 
@@ -312,18 +314,24 @@ export interface LimitOrderParams {
312
314
  * A signed limit order — the order parameters plus the EIP-712 signature.
313
315
  * This is what gets submitted to the Switch backend via `POST /limit-orders`.
314
316
  */
315
- export interface SignedLimitOrder extends LimitOrderParams {
316
- /** EIP-712 signature of the order struct, produced by the maker's wallet */
317
- signature: string;
318
- }
317
+ export interface SignedLimitOrder extends LimitOrderParams {
318
+ /** EIP-712 signature of the order struct, produced by the maker's wallet */
319
+ signature: string;
320
+ /**
321
+ * SwitchLimitOrder deployment used in the EIP-712 domain.
322
+ * Include this when submitting Robinhood orders or orders signed against an
323
+ * older supported deployment so the backend verifies the correct domain.
324
+ */
325
+ limitOrderContract?: string;
326
+ }
319
327
 
320
328
  // -- API request/response types --
321
329
 
322
330
  /** Body for `POST /limit-orders` */
323
331
  export type CreateLimitOrderRequest = SignedLimitOrder;
324
332
 
325
- /** Body for `DELETE /limit-orders` */
326
- export interface CancelLimitOrderRequest {
333
+ /** @deprecated Current hosted API cancellation is on-chain only. */
334
+ export interface CancelLimitOrderRequest {
327
335
  /** Maker address */
328
336
  maker: string;
329
337
  /** Nonce of the order to cancel */
@@ -359,7 +367,7 @@ export interface LimitOrderRecord {
359
367
  nonce: number;
360
368
  /** Fee mode flag */
361
369
  feeOnOutput: boolean;
362
- /** Unwrap output to native PLS flag */
370
+ /** Unwrap wrapped-native output to PLS/ETH on the selected network */
363
371
  unwrapOutput: boolean;
364
372
  /** Partner address for fee sharing */
365
373
  partnerAddress: string;
@@ -399,8 +407,8 @@ export interface CreateLimitOrderResponse {
399
407
  order: LimitOrderRecord;
400
408
  }
401
409
 
402
- /** Response from `DELETE /limit-orders` (success) */
403
- export interface CancelLimitOrderResponse {
410
+ /** @deprecated Current hosted API cancellation is on-chain only. */
411
+ export interface CancelLimitOrderResponse {
404
412
  success: true;
405
413
  }
406
414
 
@@ -429,13 +437,29 @@ export interface LimitOrderPair {
429
437
  }
430
438
 
431
439
  /** Response from `GET /limit-orders/stats` */
432
- export interface LimitOrderStats {
440
+ export interface LimitOrderStats {
433
441
  active: number;
434
442
  filled: number;
435
443
  cancelled: number;
436
444
  expired: number;
437
445
  total: number;
438
- }
446
+ }
447
+
448
+ /** Response from `GET /limit-orders/config`. */
449
+ export interface LimitOrderConfigResponse {
450
+ limitOrderContract: string;
451
+ allLimitOrderContracts: string[];
452
+ plsFlowContract: string | null;
453
+ allPlsFlowContracts: string[];
454
+ limitOrderContractVersions: Record<string, string>;
455
+ plsFlowContractVersions: Record<string, string>;
456
+ eip712Domain: {
457
+ name: "SwitchLimitOrder";
458
+ version: "2";
459
+ chainId: number;
460
+ verifyingContract: string;
461
+ };
462
+ }
439
463
 
440
464
  /** Union type for limit order mutation responses */
441
465
  export type LimitOrderMutationResponse =