@switch-win/sdk 1.0.7 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@switch-win/sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Official integration kit for the Switch DEX Aggregator on PulseChain — types, constants, ABIs, limit orders, and examples",
5
5
  "author": "BuildTheTech",
6
6
  "license": "MIT",
package/src/constants.ts CHANGED
@@ -54,12 +54,28 @@ export const WPLS = "0xA1077a294dDE1B09bB078844df40758a5D0f9a27";
54
54
  // ── Limit Order contract ────────────────────────────────────────────────
55
55
 
56
56
  /**
57
- * SwitchLimitOrder contract address on PulseChain (V4).
57
+ * SwitchLimitOrder contract address on PulseChain.
58
58
  *
59
+ * This is the current production limit order contract.
60
+ * For integrators, treat this as user-facing V2.
59
61
  * The EIP-712 domain `verifyingContract` MUST match this address.
60
62
  */
61
63
  export const SWITCH_LIMIT_ORDER = "0x8e3881bdF81Fc0211383B2e576076B654F7aFD86";
62
64
 
65
+ /**
66
+ * Previous production SwitchLimitOrder contract on PulseChain.
67
+ *
68
+ * For integrators, treat this as user-facing V1.
69
+ */
70
+ export const SWITCH_LIMIT_ORDER_V1 = "0x0e884072a891b406c0d814907a1e2310fe5f5deb";
71
+
72
+ /**
73
+ * Current production SwitchLimitOrder contract alias.
74
+ *
75
+ * Use this if you want explicit user-facing version naming in integrations.
76
+ */
77
+ export const SWITCH_LIMIT_ORDER_V2 = SWITCH_LIMIT_ORDER;
78
+
63
79
  /**
64
80
  * SwitchPLSFlow contract address on PulseChain.
65
81
  *
package/src/index.ts CHANGED
@@ -75,6 +75,8 @@ export {
75
75
  // Constants — Limit Orders
76
76
  export {
77
77
  SWITCH_LIMIT_ORDER,
78
+ SWITCH_LIMIT_ORDER_V1,
79
+ SWITCH_LIMIT_ORDER_V2,
78
80
  SWITCH_PLS_FLOW,
79
81
  LIMIT_ORDER_API_BASE,
80
82
  LIMIT_ORDERS_ENDPOINT,
@@ -181,7 +181,18 @@ export function buildLimitOrder(options: BuildLimitOrderOptions): LimitOrderPara
181
181
  * const signature = await signer._signTypedData(domain, types, order);
182
182
  * ```
183
183
  */
184
- export function getEIP712SigningParams() {
184
+ export function getEIP712SigningParams(limitOrderContract?: string) {
185
+ if (limitOrderContract) {
186
+ return {
187
+ domain: {
188
+ name: "SwitchLimitOrder" as const,
189
+ version: "2" as const,
190
+ chainId: 369 as const,
191
+ verifyingContract: limitOrderContract,
192
+ },
193
+ types: LIMIT_ORDER_EIP712_TYPES,
194
+ } as const;
195
+ }
185
196
  return {
186
197
  domain: LIMIT_ORDER_EIP712_DOMAIN,
187
198
  types: LIMIT_ORDER_EIP712_TYPES,
@@ -199,8 +210,8 @@ export function getEIP712SigningParams() {
199
210
  *
200
211
  * @returns The SwitchLimitOrder contract address
201
212
  */
202
- export function getApprovalTarget(): string {
203
- return SWITCH_LIMIT_ORDER;
213
+ export function getApprovalTarget(limitOrderContract?: string): string {
214
+ return limitOrderContract || SWITCH_LIMIT_ORDER;
204
215
  }
205
216
 
206
217
  /**
@@ -350,6 +361,8 @@ export interface ListLimitOrdersOptions {
350
361
  * where the maker is the PLSFlow contract but the user is the recipient.
351
362
  */
352
363
  owner?: string;
364
+ /** Filter by partner address */
365
+ partnerAddress?: string;
353
366
  /** Filter by input token address */
354
367
  tokenIn?: string;
355
368
  /** Filter by output token address */
@@ -382,6 +395,12 @@ export interface ListLimitOrdersOptions {
382
395
  * tokenOut: "0xPLSXAddress",
383
396
  * status: "FILLED",
384
397
  * });
398
+ *
399
+ * // Orders attributed to a specific partner
400
+ * const partnerOrders = await fetchLimitOrders({
401
+ * partnerAddress: "0xPartnerAddress",
402
+ * status: "ACTIVE",
403
+ * });
385
404
  * ```
386
405
  */
387
406
  export async function fetchLimitOrders(
@@ -391,6 +410,7 @@ export async function fetchLimitOrders(
391
410
  if (options.status) params.set("status", options.status);
392
411
  if (options.maker) params.set("maker", options.maker);
393
412
  if (options.owner) params.set("owner", options.owner);
413
+ if (options.partnerAddress) params.set("partnerAddress", options.partnerAddress);
394
414
  if (options.tokenIn) params.set("tokenIn", options.tokenIn);
395
415
  if (options.tokenOut) params.set("tokenOut", options.tokenOut);
396
416
  if (options.pair) params.set("pair", options.pair);
package/src/types.ts CHANGED
@@ -363,16 +363,30 @@ export interface LimitOrderRecord {
363
363
  unwrapOutput: boolean;
364
364
  /** Partner address for fee sharing */
365
365
  partnerAddress: string;
366
+ /** LO contract address this order targets for cancellation/fill */
367
+ limitOrderContract?: string;
366
368
  /** EIP-712 signature */
367
369
  signature: string;
368
370
  /** Pair key in format `tokenIn:tokenOut` (lowercased) */
369
371
  pairKey: string;
372
+ /** Sell tax on input token in basis points, when known */
373
+ tokenInSellTaxBps?: number;
374
+ /** Buy tax on input token in basis points, when known */
375
+ tokenInBuyTaxBps?: number;
376
+ /** Sell tax on output token in basis points, when known */
377
+ tokenOutSellTaxBps?: number;
378
+ /** Buy tax on output token in basis points, when known */
379
+ tokenOutBuyTaxBps?: number;
370
380
  /** Current order status */
371
381
  status: LimitOrderStatus;
372
382
  /** ISO 8601 creation timestamp */
373
383
  createdAt: string;
374
384
  /** ISO 8601 last update timestamp */
375
385
  updatedAt: string;
386
+ /** Filler address for filled orders */
387
+ filler?: string | null;
388
+ /** Filler profit in tokenIn units for filled orders */
389
+ fillerProfit?: string | null;
376
390
  /** Block number where the order was filled (if status is FILLED) */
377
391
  filledBlock?: number | null;
378
392
  /** Transaction hash of the fill (if status is FILLED) */