@switch-win/sdk 1.2.4 → 1.2.5
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 +39 -25
- package/package.json +1 -1
- package/src/constants.ts +16 -2
- package/src/index.ts +8 -4
package/README.md
CHANGED
|
@@ -217,7 +217,7 @@ For the most accurate swap quotes — especially with tax tokens — follow this
|
|
|
217
217
|
│ → Detect transfer taxes on both tokens │
|
|
218
218
|
│ → Determine feeOnOutput based on tax results + your fee strategy │
|
|
219
219
|
├────────────────────────────────────────────────────────────────────────────┤
|
|
220
|
-
│ Step 3: GET /swap/quote?...&feeOnOutput=true/false&adapters=0,3,
|
|
220
|
+
│ Step 3: GET /swap/quote?...&feeOnOutput=true/false&adapters=0,3,7 │
|
|
221
221
|
│ → Pass feeOnOutput + adapter filter for an exact expectedOutputAmount │
|
|
222
222
|
│ → Display quote and execute swap │
|
|
223
223
|
└────────────────────────────────────────────────────────────────────────────┘
|
|
@@ -407,24 +407,35 @@ curl -H "x-api-key: YOUR_KEY" "https://quote.switch.win/swap/adapters?network=pu
|
|
|
407
407
|
|
|
408
408
|
```json
|
|
409
409
|
{
|
|
410
|
-
"adapters": [
|
|
411
|
-
{ "index": 0, "name": "UniswapV2",
|
|
412
|
-
{ "index": 1, "name": "SushiV2",
|
|
413
|
-
{ "index": 2, "name": "PulseXV1",
|
|
414
|
-
{ "index": 3, "name": "PulseXV2",
|
|
415
|
-
{ "index": 4, "name": "9inchV2",
|
|
416
|
-
{ "index": 5, "name": "DextopV2",
|
|
417
|
-
{ "index": 6, "name": "
|
|
418
|
-
{ "index": 7, "name": "
|
|
419
|
-
{ "index": 8, "name": "
|
|
420
|
-
{ "index": 9, "name": "
|
|
421
|
-
{ "index": 10, "name": "
|
|
422
|
-
{ "index": 11, "name": "
|
|
423
|
-
{ "index": 12, "name": "
|
|
424
|
-
{ "index": 13, "name": "
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
|
|
410
|
+
"adapters": [
|
|
411
|
+
{ "index": 0, "name": "UniswapV2", "address": "0x971eeb4a5080834f7df2b9d7a11dfbeaa7bc187e" },
|
|
412
|
+
{ "index": 1, "name": "SushiV2", "address": "0x5ef53d5eb4f011d9bed35e7112945f0dc96b3822" },
|
|
413
|
+
{ "index": 2, "name": "PulseXV1", "address": "0x6f5ccfca1f1d3fff70202463df05573cc1668cb6" },
|
|
414
|
+
{ "index": 3, "name": "PulseXV2", "address": "0x393e382520b93b8f662dc76295000930c06d689f" },
|
|
415
|
+
{ "index": 4, "name": "9inchV2", "address": "0x4810beadf72a1f297f4e5ff71424d98b2bf4441e" },
|
|
416
|
+
{ "index": 5, "name": "DextopV2", "address": "0xd096faccdd475f2c86f3c668958fcd435e32bdc2" },
|
|
417
|
+
{ "index": 6, "name": "9mmV2", "address": "0x67a25e62309e39e7b46f3b6f868bcf336c4ce8e2" },
|
|
418
|
+
{ "index": 7, "name": "UniswapV3", "address": "0xc39cb531f71059fd427a63bf8a2f4b822d6b9b02" },
|
|
419
|
+
{ "index": 8, "name": "9mmV3", "address": "0x32a63187814d6b81badc6c13dc9d46a8050fad12" },
|
|
420
|
+
{ "index": 9, "name": "9inchV3", "address": "0xe46ef88400997a84336e1a3c14d2528da90572b6" },
|
|
421
|
+
{ "index": 10, "name": "pDexV3", "address": "0xb718836aca6ddb8745a0cecc687467dda648bdf2" },
|
|
422
|
+
{ "index": 11, "name": "DextopV3", "address": "0x8b8024ca2a4fdb34697620b80320e76c41a67124" },
|
|
423
|
+
{ "index": 12, "name": "Phux", "address": "0x98ae0249da42f789b9745b248d346a727f37e937" },
|
|
424
|
+
{ "index": 13, "name": "Tide", "address": "0xf72c3a301b533eff7e3efa32549f9c934a4f4b29" },
|
|
425
|
+
{ "index": 14, "name": "PulseXStable", "address": "0xf3b9742c859d089b6a2e3b3228dabb2c842b57d2" },
|
|
426
|
+
{ "index": 15, "name": "AgoraX", "address": "0x79ea0ec76b510d08bf4ca9a4a53a1f9f80ea1697" },
|
|
427
|
+
{ "index": 16, "name": "JoltOTC", "address": "0x033372eb8df4baad260e20d716742a825f1f113f" },
|
|
428
|
+
{ "index": 17, "name": "SwitchLimitOrder", "address": "0xa799f49dcdec9056293187faa5f6f3727942a4ca" },
|
|
429
|
+
{ "index": 18, "name": "SwitchX", "address": "0xf8744452598883792f235b92452127f4a8587db3" },
|
|
430
|
+
{ "index": 19, "name": "LibertySwapV3", "address": "0xba24bb413ab32f02073385850907ebcf0a357e70" },
|
|
431
|
+
{ "index": 20, "name": "FinvestaV3", "address": "0x012c44d0c465819ef3ceac208e0c1b272087a8b4" }
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Finvesta is a Liberty-style V3 venue with fee tiers `100`, `500`, `2500`, and
|
|
437
|
+
`10000`. It can be selected for normal routes, but it is not transfer-tax safe.
|
|
438
|
+
Always treat the live `/swap/adapters` response as the runtime source of truth.
|
|
428
439
|
|
|
429
440
|
#### Using adapter indices to filter routing
|
|
430
441
|
|
|
@@ -434,8 +445,8 @@ Pass adapter indices as a comma-separated `adapters` param to `/swap/quote`:
|
|
|
434
445
|
# Route only through PulseXV2 (index 3):
|
|
435
446
|
GET /swap/quote?...&adapters=3
|
|
436
447
|
|
|
437
|
-
# Route through PulseXV2 + UniswapV3:
|
|
438
|
-
GET /swap/quote?...&adapters=3,
|
|
448
|
+
# Route through PulseXV2 + UniswapV3:
|
|
449
|
+
GET /swap/quote?...&adapters=3,7
|
|
439
450
|
|
|
440
451
|
# Exclude nothing (default — omit the param):
|
|
441
452
|
GET /swap/quote?...
|
|
@@ -584,7 +595,7 @@ Returns the optimal split-route for a swap and (optionally) a ready-to-send tran
|
|
|
584
595
|
| `fee` | No | integer | `30` | Protocol fee in basis points (0.30 %). Range: `30`–`100`. Defaults to `30` if omitted. |
|
|
585
596
|
| `partnerAddress` | No | address | `0x0…0` | Your partner wallet to receive 50 % of collected fees. Omit or pass `0x0` for no partner. |
|
|
586
597
|
| `feeOnOutput` | No | string | `"false"` | Controls fee mode. `"true"` = fee deducted from output. `"false"` = fee deducted from input (default). Affects `expectedOutputAmount` accuracy — see [Swap Integration Flow](#swap-integration-flow). |
|
|
587
|
-
| `adapters` | No | string | — | Comma-separated adapter indices to restrict routing (e.g. `"3"` for PulseXV2 only, `"3,
|
|
598
|
+
| `adapters` | No | string | — | Comma-separated adapter indices to restrict routing (e.g. `"3"` for PulseXV2 only, `"3,7"` for PulseXV2 + UniswapV3). Get available indices from [List Adapters](#list-adapters). |
|
|
588
599
|
|
|
589
600
|
> \* If `sender` is omitted, the response will still contain routing data, `minAmountOut`, and tax info, but the `tx` object will be absent. This is useful for **showing estimated swap output before the user connects their wallet** — you can display prices, routes, and tax warnings without requiring a wallet connection. Once the user connects, re-fetch the quote with `sender` to get the ready-to-send `tx` object.
|
|
590
601
|
|
|
@@ -957,9 +968,12 @@ Robinhood constants are available from
|
|
|
957
968
|
| **SwitchLimitOrder** (V1 — legacy) | `0x0e884072a891b406C0D814907A1E2310fE5F5Deb` |
|
|
958
969
|
| **SwitchPLSFlow** (V2 — current) | `0xCf5606bdC750d8626Cec32CA2E1BB207968db1D5` |
|
|
959
970
|
| **SwitchPLSFlow** (V1 — legacy) | `0x88c9e2C83b6B7c707602e548481e58E920694E64` |
|
|
960
|
-
| **Native PLS sentinel** | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` |
|
|
961
|
-
| **WPLS** | `0xA1077a294dDE1B09bB078844df40758a5D0f9a27` |
|
|
962
|
-
| **
|
|
971
|
+
| **Native PLS sentinel** | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` |
|
|
972
|
+
| **WPLS** | `0xA1077a294dDE1B09bB078844df40758a5D0f9a27` |
|
|
973
|
+
| **Finvesta V3 adapter** | Index `20`; `0x012c44d0C465819eF3CeAC208e0c1B272087a8b4` (not transfer-tax safe) |
|
|
974
|
+
| **Finvesta V3 factory** | `0x7f5c7C5144b4B4c6e954A5b2D75C318C5467EFDc` |
|
|
975
|
+
| **Finvesta fee tiers** | `100`, `500`, `2500`, `10000` |
|
|
976
|
+
| **Fee denominator** | `10000` (basis points) |
|
|
963
977
|
| **Max slippage** | `5000` bps (50 %) |
|
|
964
978
|
| **Max fee** | `100` bps (1 %) |
|
|
965
979
|
| **Min fee** | `30` bps (0.30 %) — enforced on-chain by `MIN_FEE` |
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -48,8 +48,22 @@ export const SWITCH_ROUTER = "0x0305fcb5dA680EA6fd1B01A96C1949175B99d406";
|
|
|
48
48
|
*/
|
|
49
49
|
export const NATIVE_PLS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
50
50
|
|
|
51
|
-
/** Wrapped PLS (WPLS) ERC-20 token address */
|
|
52
|
-
export const WPLS = "0xA1077a294dDE1B09bB078844df40758a5D0f9a27";
|
|
51
|
+
/** Wrapped PLS (WPLS) ERC-20 token address */
|
|
52
|
+
export const WPLS = "0xA1077a294dDE1B09bB078844df40758a5D0f9a27";
|
|
53
|
+
|
|
54
|
+
/** Finvesta's production Liberty-style V3 adapter index in SwitchRouter. */
|
|
55
|
+
export const FINVESTA_V3_ADAPTER_INDEX = 20;
|
|
56
|
+
|
|
57
|
+
/** Verified Finvesta V3 adapter. Not safe for transfer-tax-sensitive hops. */
|
|
58
|
+
export const FINVESTA_V3_ADAPTER =
|
|
59
|
+
"0x012c44d0C465819eF3CeAC208e0c1B272087a8b4";
|
|
60
|
+
|
|
61
|
+
/** Finvesta V3 factory queried by the adapter. */
|
|
62
|
+
export const FINVESTA_V3_FACTORY =
|
|
63
|
+
"0x7f5c7C5144b4B4c6e954A5b2D75C318C5467EFDc";
|
|
64
|
+
|
|
65
|
+
/** Factory-enabled Finvesta fee tiers, in hundredths of one basis point. */
|
|
66
|
+
export const FINVESTA_V3_FEE_TIERS = [100, 500, 2500, 10000] as const;
|
|
53
67
|
|
|
54
68
|
// ── Limit Order contract ────────────────────────────────────────────────
|
|
55
69
|
|
package/src/index.ts
CHANGED
|
@@ -59,10 +59,14 @@ export {
|
|
|
59
59
|
ADAPTERS_ENDPOINT,
|
|
60
60
|
CHECK_TAX_ENDPOINT,
|
|
61
61
|
CHAIN_ID,
|
|
62
|
-
SWITCH_ROUTER,
|
|
63
|
-
NATIVE_PLS,
|
|
64
|
-
WPLS,
|
|
65
|
-
|
|
62
|
+
SWITCH_ROUTER,
|
|
63
|
+
NATIVE_PLS,
|
|
64
|
+
WPLS,
|
|
65
|
+
FINVESTA_V3_ADAPTER_INDEX,
|
|
66
|
+
FINVESTA_V3_ADAPTER,
|
|
67
|
+
FINVESTA_V3_FACTORY,
|
|
68
|
+
FINVESTA_V3_FEE_TIERS,
|
|
69
|
+
FEE_DENOMINATOR,
|
|
66
70
|
MAX_FEE_BPS,
|
|
67
71
|
MAX_SLIPPAGE_BPS,
|
|
68
72
|
DEFAULT_SLIPPAGE_BPS,
|