@switch-win/sdk 1.0.1 → 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.
- package/README.md +10 -7
- package/abi/SwitchLimitOrderABI.json +1295 -1296
- package/abi/SwitchRouterABI.json +1 -1
- package/package.json +1 -1
- package/src/constants.ts +9 -8
- package/src/limit-orders.ts +6 -0
- package/src/types.ts +7 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
Everything partners need to integrate Switch swaps and limit orders — API docs, TypeScript types, ABIs, constants, and ready-to-use examples.
|
|
9
9
|
|
|
10
|
-
**Swap API:** `https://quote.switch.win` | **Limit Order API:** `https://
|
|
10
|
+
**Swap API:** `https://quote.switch.win` | **Limit Order API:** `https://quote.switch.win` | **Chain:** PulseChain (369)
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -616,14 +616,15 @@ GET /swap/quote?network=pulsechain&from=0xA1077a294dDE1B09bB078844df40758a5D0f9a
|
|
|
616
616
|
]
|
|
617
617
|
},
|
|
618
618
|
// Transaction object — only present when `sender` is provided
|
|
619
|
+
// ⚠️ Always use tx.to from this response — do NOT hardcode the router address
|
|
619
620
|
"tx": {
|
|
620
|
-
"to": "
|
|
621
|
+
"to": "0x99999d19eC98F936934e029e63D1C0A127a15207",
|
|
621
622
|
"data": "0x...", // ABI-encoded goSwitch() calldata with feeOnOutput = false
|
|
622
623
|
"value": "0" // "0" for ERC-20 input; amountIn for native PLS input
|
|
623
624
|
},
|
|
624
625
|
// Same swap but with fee taken from the output token instead
|
|
625
626
|
"txFeeOnOutput": {
|
|
626
|
-
"to": "
|
|
627
|
+
"to": "0x99999d19eC98F936934e029e63D1C0A127a15207",
|
|
627
628
|
"data": "0x...", // ABI-encoded goSwitch() calldata with feeOnOutput = true
|
|
628
629
|
"value": "0"
|
|
629
630
|
}
|
|
@@ -886,12 +887,14 @@ Covers: creating orders, approvals, `feeOnOutput` decision guide (tax tokens & o
|
|
|
886
887
|
|
|
887
888
|
All constants are importable from [`src/constants.ts`](src/constants.ts).
|
|
888
889
|
|
|
890
|
+
> **⚠️ Do not hardcode the SwitchRouter address.** The router contract may be redeployed from time to time. Always use the `tx.to` (or `txFeeOnOutput.to`) address returned by the `/bestPath` API response when building your transaction. This ensures your integration automatically picks up router upgrades without code changes.
|
|
891
|
+
|
|
889
892
|
| Name | Value |
|
|
890
893
|
|---|---|
|
|
891
894
|
| **Chain** | PulseChain (Chain ID `369`) |
|
|
892
|
-
| **SwitchRouter** | `
|
|
893
|
-
| **SwitchLimitOrder** | `
|
|
894
|
-
| **SwitchPLSFlow** | `
|
|
895
|
+
| **SwitchRouter** | `0x99999d19eC98F936934e029e63D1C0A127a15207` |
|
|
896
|
+
| **SwitchLimitOrder** | `0x79925587bE77C25b292C0ecA6FEdD3A3f07916F9` |
|
|
897
|
+
| **SwitchPLSFlow** | `0x79D1Ce697509D75D79c6cA8f9232ee6ca6Df379a` |
|
|
895
898
|
| **Native PLS sentinel** | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` |
|
|
896
899
|
| **WPLS** | `0xA1077a294dDE1B09bB078844df40758a5D0f9a27` |
|
|
897
900
|
| **Fee denominator** | `10000` (basis points) |
|
|
@@ -900,7 +903,7 @@ All constants are importable from [`src/constants.ts`](src/constants.ts).
|
|
|
900
903
|
| **Min fee** | `30` bps (0.30 %) — enforced on-chain by `MIN_FEE` |
|
|
901
904
|
| **Default slippage** | `50` bps (0.50 %) |
|
|
902
905
|
| **Swap API base** | `https://quote.switch.win` |
|
|
903
|
-
| **Limit Order API base** | `https://
|
|
906
|
+
| **Limit Order API base** | `https://quote.switch.win` |
|
|
904
907
|
|
|
905
908
|
---
|
|
906
909
|
|