@switch-win/sdk 1.0.2 → 1.0.3

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.
@@ -821,7 +821,7 @@
821
821
  },
822
822
  {
823
823
  "type": "event",
824
- "name": "SwitchSwap",
824
+ "name": "Switched",
825
825
  "inputs": [
826
826
  {
827
827
  "name": "_tokenIn",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@switch-win/sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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
@@ -33,7 +33,7 @@ export const CHAIN_ID = 369;
33
33
  // ── Contract addresses --
34
34
 
35
35
  /** SwitchRouter contract — target for all swap transactions */
36
- export const SWITCH_ROUTER = "0x31077B259e7fEEB7bE39bF298274BaE94Ee57B7a";
36
+ export const SWITCH_ROUTER = "0x99999d19eC98F936934e029e63D1C0A127a15207";
37
37
 
38
38
  /**
39
39
  * Native PLS sentinel address.
@@ -51,7 +51,7 @@ export const WPLS = "0xA1077a294dDE1B09bB078844df40758a5D0f9a27";
51
51
  *
52
52
  * The EIP-712 domain `verifyingContract` MUST match this address.
53
53
  */
54
- export const SWITCH_LIMIT_ORDER = "0x28754379e9E9867A64b77437930cBc5009939692";
54
+ export const SWITCH_LIMIT_ORDER = "0x79925587bE77C25b292C0ecA6FEdD3A3f07916F9";
55
55
 
56
56
  /**
57
57
  * SwitchPLSFlow contract address on PulseChain.
@@ -60,7 +60,7 @@ export const SWITCH_LIMIT_ORDER = "0x28754379e9E9867A64b77437930cBc5009939692";
60
60
  * which wraps to WPLS and creates the limit order on their behalf.
61
61
  * No EIP-712 signing required — single transaction.
62
62
  */
63
- export const SWITCH_PLS_FLOW = "0x0fD3fD40F06159606165F21047B83136172273E3";
63
+ export const SWITCH_PLS_FLOW = "0x79D1Ce697509D75D79c6cA8f9232ee6ca6Df379a";
64
64
 
65
65
  // ── Limit Order API endpoints ───────────────────────────────────────────────
66
66
 
@@ -128,7 +128,7 @@ export const ERC20_ABI = [
128
128
  * Useful only if you want to decode or manually construct calldata.
129
129
  */
130
130
  export const GO_SWITCH_ABI = [
131
- "function goSwitch(tuple(uint256 amountIn, tuple(address tokenIn, address tokenOut, tuple(address adapter, uint256 amountIn)[] legs)[] hops)[] _routes, address _to, uint256 _minTotalAmountOut, uint256 _fee, bool _feeOnOutput, bool _unwrapOutput, address _partnerAddress) payable",
131
+ "function goSwitch(tuple(uint256 amountIn, tuple(address tokenIn, address tokenOut, tuple(address adapter, uint256 amountIn, uint24 fee)[] legs)[] hops)[] _routes, address _to, uint256 _minTotalAmountOut, uint256 _fee, bool _feeOnOutput, bool _unwrapOutput, address _partnerAddress) payable",
132
132
  ] as const;
133
133
 
134
134
  /**
@@ -179,6 +179,7 @@ export const LIMIT_ORDER_EIP712_TYPES = {
179
179
  { name: "feeOnOutput", type: "bool" },
180
180
  { name: "recipient", type: "address" },
181
181
  { name: "unwrapOutput", type: "bool" },
182
+ { name: "partnerAddress", type: "address" },
182
183
  ],
183
184
  } as const;
184
185
 
@@ -197,7 +198,7 @@ export const LIMIT_ORDER_ABI = [
197
198
  "function invalidateNonce(uint256 _nonce) external",
198
199
  "function invalidateNonces(uint256[] calldata _nonces) external",
199
200
  "function isNonceUsed(address maker, uint256 nonce) view returns (bool)",
200
- "function canFillOrder(tuple(address maker, address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut, uint256 deadline, uint256 nonce, bool feeOnOutput, address recipient, bool unwrapOutput) order, bytes signature) view returns (bool)",
201
+ "function canFillOrder(tuple(address maker, address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut, uint256 deadline, uint256 nonce, bool feeOnOutput, address recipient, bool unwrapOutput, address partnerAddress) order, bytes signature) view returns (bool)",
201
202
  ] as const;
202
203
 
203
204
  /**
@@ -223,10 +224,10 @@ export const LIMIT_ORDER_ERRORS = [
223
224
  * of the sender.
224
225
  */
225
226
  export const PLS_FLOW_ABI = [
226
- "function createOrder(address tokenOut, uint256 minAmountOut, uint256 deadline, bool feeOnOutput, bool unwrapOutput) payable returns (uint256 nonce)",
227
+ "function createOrder(address tokenOut, uint256 minAmountOut, uint256 deadline, bool feeOnOutput, bool unwrapOutput, address partnerAddress) payable returns (uint256 nonce)",
227
228
  "function cancelOrder(uint256 nonce) external",
228
229
  "function orderNonces(address owner) view returns (uint256)",
229
- "event PLSOrderCreated(address indexed owner, uint256 indexed nonce, address tokenOut, uint256 amountIn, uint256 minAmountOut, uint256 deadline, bool feeOnOutput, bool unwrapOutput)",
230
+ "event PLSOrderCreated(address indexed owner, uint256 indexed nonce, address tokenOut, uint256 amountIn, uint256 minAmountOut, uint256 deadline, bool feeOnOutput, bool unwrapOutput, address partnerAddress)",
230
231
  ] as const;
231
232
 
232
233
  /**
@@ -124,6 +124,11 @@ export interface BuildLimitOrderOptions {
124
124
  * before sending to the recipient. Default `false`.
125
125
  */
126
126
  unwrapOutput?: boolean;
127
+ /**
128
+ * Partner address to receive 50% of protocol fees.
129
+ * Defaults to the zero address (no partner).
130
+ */
131
+ partnerAddress?: string;
127
132
  }
128
133
 
129
134
  /**
@@ -157,6 +162,7 @@ export function buildLimitOrder(options: BuildLimitOrderOptions): LimitOrderPara
157
162
  feeOnOutput: options.feeOnOutput ?? false,
158
163
  recipient: options.recipient ?? options.maker,
159
164
  unwrapOutput: options.unwrapOutput ?? false,
165
+ partnerAddress: options.partnerAddress ?? ZERO_ADDRESS,
160
166
  };
161
167
  }
162
168
 
package/src/types.ts CHANGED
@@ -301,6 +301,11 @@ export interface LimitOrderParams {
301
301
  * before sending to the recipient.
302
302
  */
303
303
  unwrapOutput: boolean;
304
+ /**
305
+ * Partner address to receive 50% of protocol fees.
306
+ * Use the zero address (`0x0000…`) for no partner.
307
+ */
308
+ partnerAddress: string;
304
309
  }
305
310
 
306
311
  /**
@@ -356,6 +361,8 @@ export interface LimitOrderRecord {
356
361
  feeOnOutput: boolean;
357
362
  /** Unwrap output to native PLS flag */
358
363
  unwrapOutput: boolean;
364
+ /** Partner address for fee sharing */
365
+ partnerAddress: string;
359
366
  /** EIP-712 signature */
360
367
  signature: string;
361
368
  /** Pair key in format `tokenIn:tokenOut` (lowercased) */